def get_labels(fields, doctype):
 labels = []
 for key in fields:
  key = key.split(u' as ')[0]
  if (u'.' in key):
   (parenttype, fieldname) = (key.split(u'.')[0][4:(-1)], key.split(u'.')[1].strip(u'`'))
  else:
   parenttype = doctype
   fieldname = fieldname.strip(u'`')
  df = frappe.get_meta(parenttype).get_field(fieldname)
  label = (df.label if df else fieldname.title())
  if (label in labels):
   label = ((doctype + u': ') + label)
  labels.append(label)
 return labels

def get_labels ( fields , doctype ) : labels = [ ] for key in fields : key = key . split ( u' as ' ) [ 0 ] if ( u'.' in key ) : ( parenttype , fieldname ) = ( key . split ( u'.' ) [ 0 ] [ 4 : ( - 1 ) ] , key . split ( u'.' ) [ 1 ] . strip ( u'`' ) ) else : parenttype = doctype fieldname = fieldname . strip ( u'`' ) df = frappe . get_meta ( parenttype ) . get_field ( fieldname ) label = ( df . label if df else fieldname . title ( ) ) if ( label in labels ) : label = ( ( doctype + u': ' ) + label ) labels . append ( label ) return labels
get labels .