def get_volumes_by_instance(instance):
    """
    Returns a list of volumes attached to `instance`.
    """
    def attached(volume):
        return volume.attach_data.instance_id == instance.id

    return [v for v in instance.connection.get_all_volumes() if attached(v)]