docs: def login_to_portal(cls,
                          domain=None,
                          portal_name=None,
                          user=None,
                          credential=None,
                          use_token=False,
                          portal_id=None,
                          # portal_rid=None,
                          get_devices=False,
                          debug=False):
          """
              A classmethod that returns a (token, Portals object) tuple.
  
              This method can be interactive based on the input arguments.
  
              Sets up the Portals object with all the member variables
              it needs to make future api calls. It basically just calls 
              Portals.get_portal_by_name(), but instead of returning a 
              Portals object, it returns a Portals() object.
  
              This is a convenience function that can be called at the 
              time of instantiation.
  
              Instantiate the Portals object with user/password authentication
              then call this function. The resultant object will be a Portals
              object that uses token authentication for all future calls 
              instead of using user/password credentials.
  
              Examples:
                  # for interactive mode, get a password prompt, a token 
                  # and a logged-in Portals object
                  token, B = Portals.login_to_portal( domain=<domain>,
                                                       portal_name=<portal>,
                                                       user=<user/email>
                  )
  
                  # for non-interactive mode, passing in user password to 
                  # get a token and a logged-in Portals object
                  token, B = Portals.login_to_portal( domain=<domain>,
                                                       portal_name=<portal>,
                                                       user=<user/email>,
                                                       credential=<password>
                  )
  
                  # for non-interactive mode, passing in token to get a 
                  # logged-in Portals object
                  token, B = Portals.login_to_portal( domain=<domain>,
                                                       portal_name=<portal>,
                                                       user=<user/email>,
                                                       credential=<token>,
                                                       use_token=True
                  )
  
                  # for non-interactive mode, passing in token and id 
                  # to get a Portals object that doesn't need to make any 
                  # Portals API calls. 
                  token, B = Portals.login_to_portal( domain=<domain>,
                                                       portal_name=<portal>,
                                                       user=<user/email>,
                                                       credential=<token>,
                                                       use_token=True,
                                                       portal_id=<portal_id>,
                                                       portal_rid=<portal_rid>
                  )
          """
          if domain is None:
              domain = _input("Enter domain: ")
          if portal_name is None:
              portal_name = _input("Enter name of Portal: ")
          if user is None:
              user = _input("Enter username: ")
          if None is credential:
              # interactive mode
              B = Portals(   domain=domain,
                              portal_name=portal_name,
                              user=user,
                              debug=debug
              )
              token = B.get_user_token()
              # print("Got token {0}".format(token))
          elif not None is credential and not use_token:
              # non-interactive, using a user-password to retrieve token
              B = Portals(   domain=domain,
                              portal_name=portal_name,
                              user=user,
                              auth=credential,
                              debug=debug
              )
              token = B.get_user_token()
          elif not None is credential and use_token:
              # non-interactive, mainly just need to instantiate an object.
              B = Portals(   domain=domain,
                              portal_name=portal_name,
                              user=user,
                              auth=credential,
                              use_token=use_token,
                              debug=debug
              )
              token = credential
  
          if portal_id is None: # or portal_rid is None:
              B.get_portal_by_name(B.portal_name())
          else:
              B.set_portal_id(portal_id)
              # B.set_portal_rid(portal_rid)
          if get_devices:
              B.map_aliases_to_device_objects()
          return token, B