def signed_natsort(data):
 if (not data):
  return data
 if (not all([(isinstance(element, tuple) or isinstance(element, list) or isinstance(element, dict)) for element in data])):
  try:
   return sorted(data, key=float)
  except ValueError:
   return natsort(data)
 try:
  return sorted(data, key=(lambda tup: float(tup[0])))
 except ValueError:
  return natsort(data)

def signed_natsort ( data ) : if ( not data ) : return data if ( not all ( [ ( isinstance ( element , tuple ) or isinstance ( element , list ) or isinstance ( element , dict ) ) for element in data ] ) ) : try : return sorted ( data , key = float ) except ValueError : return natsort ( data ) try : return sorted ( data , key = ( lambda tup : float ( tup [ 0 ] ) ) ) except ValueError : return natsort ( data )
sort an iterable considering the cases where elements are signed data: list of tuples or strings .