@classmethod
def close(cls, cursor, connection, commit=False):
    """
        Closes the cursor and the connection. If the commit flag is set, before closing the cursor, the current
        transaction will be committed. When a pooled connection is closed, the connection will just be returned to the
        pool.
        :param cursor: a currently active cursor
        :param connection: a currently active connection
        :param commit: an optional boolean flag to show whether to commit or not before closing the connection/cursor
        """
    if connection is None or cursor is None:
        return
    if commit:
        connection.commit()
    cursor.close()
    connection.close()
