def try_dbfield(fn, field_class):
 for cls in field_class.mro():
  if (cls is models.Field):
   continue
  data = fn(cls)
  if data:
   return data

def try_dbfield ( fn , field_class ) : for cls in field_class . mro ( ) : if ( cls is models . Field ) : continue data = fn ( cls ) if data : return data
try fn with the db field_class by walking its mro until a result is found .