def getSender(email):
 sender = email['From']
 m = re.match('(.*)\\s<.*>', sender)
 if m:
  return m.group(1)
 return sender

def getSender ( email ) : sender = email [ 'From' ] m = re . match ( '(.*)\\s<.*>' , sender ) if m : return m . group ( 1 ) return sender
returns the best-guess sender of an email .