docs: def psyplot_fname(env_key='PSYPLOTRC', fname='psyplotrc.yml',
                    if_exists=True):
      """
      Get the location of the config file.
  
      The file location is determined in the following order
  
      - `$PWD/psyplotrc.yml`
  
      - environment variable `PSYPLOTRC` (pointing to the file location or a
        directory containing the file `psyplotrc.yml`)
  
      - `$PSYPLOTCONFIGDIR/psyplot`
  
      - On Linux and osx,
  
            - `$HOME/.config/psyplot/psyplotrc.yml`
  
      - On other platforms,
  
           - `$HOME/.psyplot/psyplotrc.yml` if `$HOME` is defined.
  
      - Lastly, it looks in `$PSYPLOTDATA/psyplotrc.yml` for a
        system-defined copy.
  
      Parameters
      ----------
      env_key: str
          The environment variable that can be used for the configuration
          directory
      fname: str
          The name of the configuration file
      if_exists: bool
          If True, the path is only returned if the file exists
  
      Returns
      -------
      None or str
          None, if no file could be found and `if_exists` is True, else the path
          to the psyplot configuration file
  
      Notes
      -----
      This function is motivated by the :func:`matplotlib.matplotlib_fname`
      function"""
      cwd = getcwd()
      full_fname = os.path.join(cwd, fname)
      if os.path.exists(full_fname):
          return full_fname
  
      if env_key in os.environ:
          path = os.environ[env_key]
          if os.path.exists(path):
              if os.path.isdir(path):
                  full_fname = os.path.join(path, fname)
                  if os.path.exists(full_fname):
                      return full_fname
              else:
                  return path
  
      configdir = get_configdir()
      if configdir is not None:
          full_fname = os.path.join(configdir, fname)
          if os.path.exists(full_fname) or not if_exists:
              return full_fname
  
      return None