<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def emit_containers(self, containers, verbose=True):
 """ Emits the task definition and sorts containers by name :param containers: List of the container definitions :type containers: list of dict :param verbose: Print out newlines and indented JSON :type verbose: bool :returns: The text output :rtype: str """

        containers = sorted(containers, key=lambda c: c.get('name'))
        task_definition = {
            'family': self.family,
            'containerDefinitions': containers,
            'volumes': self.volumes or []
        }
        if verbose:
            return json.dumps(task_definition, indent=4, sort_keys=True)
        else:
            return json.dumps(task_definition)