def invalid_email_reason(email_address, field):
 if (email_address is None):
  return ('None email address for %s.' % field)
 if isinstance(email_address, users.User):
  email_address = email_address.email()
 if (not isinstance(email_address, basestring)):
  return ('Invalid email address type for %s.' % field)
 stripped_address = email_address.strip()
 if (not stripped_address):
  return ('Empty email address for %s.' % field)
 return None

def invalid_email_reason ( email_address , field ) : if ( email_address is None ) : return ( 'None email address for %s.' % field ) if isinstance ( email_address , users . User ) : email_address = email_address . email ( ) if ( not isinstance ( email_address , basestring ) ) : return ( 'Invalid email address type for %s.' % field ) stripped_address = email_address . strip ( ) if ( not stripped_address ) : return ( 'Empty email address for %s.' % field ) return None
determine reason why email is invalid .