code: def get_password(entry=None, username=None, prompt=None, always_ask=False):
      
  
      password = None
  
      if username is None:
          username = get_username()
  
      has_keychain = initialize_keychain()
  
      # Unlock the user's keychain otherwise, if running under SSH, 'security(1)' will thrown an error.
      unlock_keychain(username)
  
      if prompt is None:
          prompt = "Enter %s's password: " % username
  
      if has_keychain and entry is not None and always_ask is False:
          password = get_password_from_keyring(entry, username)
  
      if password is None:
          password = getpass.getpass(prompt=prompt)
  
      return password
docs: Prompt the user for a password on stdin.
  
        :param username: The username to get the password for. Default is the current user.
        :param entry: The entry in the keychain. This is a caller specific key.
        :param prompt: The entry in the keychain. This is a caller specific key.
        :param always_ask: Force the user to enter the password every time.