code: def getaddresses (addr):
      
      parsed = [mail for name, mail in AddressList(addr).addresslist if mail]
      if parsed:
          addresses = parsed
      elif addr:
          # we could not parse any mail addresses, so try with the raw string
          addresses = [addr]
      else:
          addresses = []
      return addresses
docs: Return list of email addresses from given field value.