'We need to use socket._fileobject Because SSL.Connection
doesn\'t have a \'dup\'. Not exactly sure WHY this is, but
this is backed up by comments in socket.py and SSL/connection.c
Since httplib.HTTPSResponse/HTTPConnection depend on the
socket being duplicated when they close it, we refcount the
socket object and don\'t actually close until its count is 0.'

def makefile(self, mode, bufsize):

    self.close_refcount += 1
    return socket._fileobject(self, mode, bufsize, close=True)
