def remove_trailing_data_field(fields):
 try:
  get_model_from_relation(fields[(-1)])
 except NotRelationField:
  fields = fields[:(-1)]
 return fields

def remove_trailing_data_field ( fields ) : try : get_model_from_relation ( fields [ ( - 1 ) ] ) except NotRelationField : fields = fields [ : ( - 1 ) ] return fields
discard trailing non-relation field if extant .