<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_consumer_info(self, instance, cursor):
 """Collects metrics for all consumers on the connected database."""

        cursor.execute(self.CONSUMER_INFO_STATEMENT)
        for queue_name, consumer_name, lag, pending_events, last_seen in cursor:
            yield queue_name, consumer_name, {
                'lag': lag,
                'pending_events': pending_events,
                'last_seen': last_seen,
            }