code: def check_exists(path, type='file'):
      
  
      if type == 'file':
          if not os.path.isfile(path):
              raise RuntimeError('The file `%s` does not exist.' % path)
      else:
          if not os.path.isdir(path):
              raise RuntimeError('The folder `%s` does not exist.' % path)
  
      return True
docs: Check if a file or a folder exists