parameters: (cls, username, password, email=None, analyst=None)
docstring: Create (and save) a new user with the given username, password and
          email address.
docstring_summary: Create (and save) a new user with the given username, password and
          email address.
docstring_tokens: Create ( and save ) a new user with the given username password and email address .
function: def create_user(cls, username, password, email=None, analyst=None):
          """
          Create (and save) a new user with the given username, password and
          email address.
          """
  
          now = datetime.datetime.now()
  
          # Normalize the address by lowercasing the domain part of the email
          # address.
          if email is not None:
              try:
                  email_name, domain_part = email.strip().split('@', 1)
              except ValueError:
                  pass
              else:
                  email = '@'.join([email_name, domain_part.lower()])
  
          user = cls(username=username, email=email, date_joined=now)
          user.create_api_key("default", analyst, default=True)
          if password and user.set_password(password):
              user.save(username=analyst)
              return user
          elif CRITsConfig.remote_user:
              user.save(username="CRITS_REMOTE_USER")
              return user
          else:
              return None
function_tokens: def create_user ( cls , username , password , email = None , analyst = None ) : now = datetime . datetime . now ( ) # Normalize the address by lowercasing the domain part of the email # address. if email is not None : try : email_name , domain_part = email . strip ( ) . split ( '@' , 1 ) except ValueError : pass else : email = '@' . join ( [ email_name , domain_part . lower ( ) ] ) user = cls ( username = username , email = email , date_joined = now ) user . create_api_key ( "default" , analyst , default = True ) if password and user . set_password ( password ) : user . save ( username = analyst ) return user elif CRITsConfig . remote_user : user . save ( username = "CRITS_REMOTE_USER" ) return user else : return None