code: def _load_yaml_credentials(filename=None, yaml_key=None):
      
      try:
          with open(os.path.expanduser(filename)) as f:
              search_creds = yaml.safe_load(f)[yaml_key]
      except FileNotFoundError:
          logger.error("cannot read file {}".format(filename))
          search_creds = {}
      except KeyError:
          logger.error("{} is missing the provided key: {}"
                       .format(filename, yaml_key))
          search_creds = {}
  
      return search_creds
docs: Loads and parses credentials in a YAML file. Catches common exceptions
      and returns an empty dict on error, which will be handled downstream.
  
      Returns:
          dict: parsed credentials or {}