code: def prompt_for_password(url, user=None, default_user=None):
      
      if user is None:
          default_user = default_user or getpass.getuser()
          while user is None:
              user = compat.console_input(
                  "Enter username for {} [{}]: ".format(url, default_user)
              )
              if user.strip() == "" and default_user:
                  user = default_user
      if user:
          pw = getpass.getpass(
              "Enter password for {}@{} (Ctrl+C to abort): ".format(user, url)
          )
          if pw or pw == "":
              return (user, pw)
      return None
docs: Prompt for username and password.
  
      If a user name is passed, only prompt for a password.
      Args:
          url (str): hostname
          user (str, optional):
              Pass a valid name to skip prompting for a user name
          default_user (str, optional):
              Pass a valid name that is used as default when prompting
              for a user name
      Raises:
          KeyboardInterrupt if user hits Ctrl-C
      Returns:
          (username, password) or None