docs: def _validate_fname(fname, arg_name):
      """Validate that a string is a valid file name."""
      if fname is not None:
          msg = "Argument `{0}` is not valid".format(arg_name)
          if (not isinstance(fname, str)) or (isinstance(fname, str) and ("\0" in fname)):
              raise RuntimeError(msg)
          try:
              if not os.path.exists(fname):
                  os.access(fname, os.W_OK)
          except (TypeError, ValueError):  # pragma: no cover
              raise RuntimeError(msg)