def shorten_name(name, max_length):
 if (len(name) <= max_length):
  return name
 (q, r) = divmod((max_length - 3), 2)
 return ((name[:(q + r)] + '...') + name[(- q):])

def shorten_name ( name , max_length ) : if ( len ( name ) <= max_length ) : return name ( q , r ) = divmod ( ( max_length - 3 ) , 2 ) return ( ( name [ : ( q + r ) ] + '...' ) + name [ ( - q ) : ] )
shortens a name to the given number of characters .