<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def cleanup_images(remove_old=False, **kwargs):
 """ Removes all images that have no name, and that are not references as dependency by any other named image. Similar to the ``prune`` functionality in newer Docker versions, but supports more filters. :param remove_old: Also remove images that do have a name, but no `latest` tag. :type remove_old: bool """

    keep_tags = env.get('docker_keep_tags')
    if keep_tags is not None:
        kwargs.setdefault('keep_tags', keep_tags)
    removed_images = docker_fabric().cleanup_images(remove_old=remove_old, **kwargs)
    if kwargs.get('list_only'):
        puts('Unused images:')
        for image_name in removed_images:
            fastprint(image_name, end='\n')