def close_socket(self):
    try:
        if (self.socket is not None):
            self._socket().close()
        if (self.socket_as_file is not None):
            self._socket_as_file().close()
    finally:
        self.reset_values()
def close_socket(self):
    try:
        if (self.socket is not None):
            self._socket().close()
        if (self.socket_as_file is not None):
            self._socket_as_file().close()
    finally:
        self.reset_values()