code: def open_local_file(self, url):
          
          import future.backports.email.utils as email_utils
          import mimetypes
          host, file = splithost(url)
          localname = url2pathname(file)
          try:
              stats = os.stat(localname)
          except OSError as e:
              raise URLError(e.strerror, e.filename)
          size = stats.st_size
          modified = email_utils.formatdate(stats.st_mtime, usegmt=True)
          mtype = mimetypes.guess_type(url)[0]
          headers = email.message_from_string(
              'Content-Type: %s\nContent-Length: %d\nLast-modified: %s\n' %
              (mtype or 'text/plain', size, modified))
          if not host:
              urlfile = file
              if file[:1] == '/':
                  urlfile = 'file://' + file
              return addinfourl(open(localname, 'rb'), headers, urlfile)
          host, port = splitport(host)
          if (not port
             and socket.gethostbyname(host) in ((localhost(),) + thishost())):
              urlfile = file
              if file[:1] == '/':
                  urlfile = 'file://' + file
              elif file[:2] == './':
                  raise ValueError("local file url may start with / or file:. Unknown url of type: %s" % url)
              return addinfourl(open(localname, 'rb'), headers, urlfile)
          raise URLError('local file error: not on local host')
docs: Use local file.