code: def fake_wrap_socket(orig_wrap_socket_fn, *args, **kw):
      
      server_hostname = kw.get('server_hostname')
      if server_hostname is not None:
          matcher = httpretty.match_https_hostname(server_hostname)
          if matcher is None:
                  return orig_wrap_socket_fn(*args, **kw)
      if 'sock' in kw:
          return kw['sock']
      else:
          return args[0]
docs: drop-in replacement for py:func:`ssl.wrap_socket`