def cursor(self, cursor_type=None):
    if self.closed():
        raise errors.ConnectionError('Connection is closed')
    if self._cursor.closed():
        self._cursor._closed = False
    self._cursor.cursor_type = cursor_type
    return self._cursor
def cursor(self, cursor_type=None):
    if self.closed():
        raise errors.ConnectionError('Connection is closed')
    if self._cursor.closed():
        self._cursor._closed = False
    self._cursor.cursor_type = cursor_type
    return self._cursor