def canonicalize_email(email):
 if (not email):
  return ''
 email = _force_utf8(email.lower())
 (localpart, at, domain) = email.partition('@')
 if ((not at) or ('@' in domain)):
  return ''
 localpart = localpart.replace('.', '')
 localpart = localpart.partition('+')[0]
 return ((localpart + '@') + domain)

def canonicalize_email ( email ) : if ( not email ) : return '' email = _force_utf8 ( email . lower ( ) ) ( localpart , at , domain ) = email . partition ( '@' ) if ( ( not at ) or ( '@' in domain ) ) : return '' localpart = localpart . replace ( '.' , '' ) localpart = localpart . partition ( '+' ) [ 0 ] return ( ( localpart + '@' ) + domain )
return the given email address without various localpart manglings .