code: def __validate_and_fix_path(path, check_file=False, check_dir=False):
      
      # pylint: disable=superfluous-parens
      if path is None:
          return path
      else:
          if not (os.path.isfile(path) if check_file else False) \
                  and not (os.path.isdir(path) if check_dir else False):
              raise SystemExit('Path `%s` does not exist' % path)
          if not os.path.isabs(path):
              path = os.path.abspath(os.path.join(os.path.abspath(os.curdir), path))
  
      return path
docs: Check if a file/directory exists and converts relative paths to absolute ones