def normalize_together(option_together):
 try:
  if (not option_together):
   return ()
  if (not isinstance(option_together, (tuple, list))):
   raise TypeError
  first_element = next(iter(option_together))
  if (not isinstance(first_element, (tuple, list))):
   option_together = (option_together,)
  return tuple((tuple(ot) for ot in option_together))
 except TypeError:
  return option_together

def normalize_together ( option_together ) : try : if ( not option_together ) : return ( ) if ( not isinstance ( option_together , ( tuple , list ) ) ) : raise TypeError first_element = next ( iter ( option_together ) ) if ( not isinstance ( first_element , ( tuple , list ) ) ) : option_together = ( option_together , ) return tuple ( ( tuple ( ot ) for ot in option_together ) ) except TypeError : return option_together
option_together can be either a tuple of tuples .