def is_volume_attached(volume):
    """ This function checks if a volume is attached
        and returns the answer to taht question as a boolean
    """
    if not volume.get('Attachments'):
        return False
    attached_states = {'attached', 'attaching'}
    for attachment in volume['Attachments']:
        if attachment.get('State') in attached_states:
            return True
    # The volume is not attached since the above return
    # did not exit the function
    return False