<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def delete_consumer(self, consumer=None):
 """ Remove a specific consumer from a consumer group. :consumer: name of consumer to delete. If not provided, will be the default consumer for this stream. :returns: number of pending messages that the consumer had before being deleted. """

        if consumer is None: consumer = self._consumer
        return self.database.xgroup_delconsumer(self.key, self.group, consumer)