def _get_cursor(self, connection, name=None):
        """Return a cursor for the given cursor_factory. Specify a name to
        use server-side cursors.

        :param connection: The connection to create a cursor on
        :type connection: psycopg2.extensions.connection
        :param str name: A cursor name for a server side cursor
        :rtype: psycopg2.extensions.cursor

        """
        cursor = connection.cursor(name=name,
                                   cursor_factory=self._cursor_factory)
        if name is not None:
            cursor.scrollable = True
            cursor.withhold = True
        return cursor
Return a cursor for the given cursor_factory. Specify a name to
        use server-side cursors.

        :param connection: The connection to create a cursor on
        :type connection: psycopg2.extensions.connection
        :param str name: A cursor name for a server side cursor
        :rtype: psycopg2.extensions.cursor