code: def save_hash(self, location, basedir, ext=None):
          
  
          if isinstance(location, six.text_type):
              location = location.encode('utf-8')
          rel_path = hashed_path(location, ext=ext)
          path = os.path.join(basedir, rel_path)
          if not os.path.exists(path):
              path_dir, _ = os.path.split(path)
              try:
                  os.makedirs(path_dir)
              except OSError:
                  pass
              with open(path, 'wb') as out:
                  out.write(self._bytes_body)
          return rel_path
docs: Save response body into file with special path
          builded from hash. That allows to lower number of files
          per directory.
  
          :param location: URL of file or something else. It is
              used to build the SHA1 hash.
          :param basedir: base directory to save the file. Note that
              file will not be saved directly to this directory but to
              some sub-directory of `basedir`
          :param ext: extension which should be appended to file name. The
              dot is inserted automatically between filename and extension.
          :returns: path to saved file relative to `basedir`
  
          Example::
  
              >>> url = 'http://yandex.ru/logo.png'
              >>> g.go(url)
              >>> g.response.save_hash(url, 'some_dir', ext='png')
              'e8/dc/f2918108788296df1facadc975d32b361a6a.png'
              # the file was saved to $PWD/some_dir/e8/dc/...
  
          TODO: replace `basedir` with two options: root and save_to. And
          returns save_to + path