def decs_osimage_package_facts(arg_osimage_facts, arg_check_mode=False):
    """Package a dictionary of OS image according to the decs_osimage module specification. This 
    dictionary will be returned to the upstream Ansible engine at the completion of the module run.

    @param arg_osimage_facts: dictionary with OS image facts as returned by API call to .../images/list
    @param arg_check_mode: boolean that tells if this Ansible module is run in check mode.

    @return: dictionary with OS image specs populated from arg_osimage_facts.
    """

    ret_dict = dict(id=0,
                    name="none",
                    size=0,
                    type="none",
                    state="CHECK_MODE",
                    )

    if arg_check_mode:
        # in check mode return immediately with the default values
        return ret_dict

    if arg_osimage_facts is None:
        # if void facts provided - change state value to ABSENT and return
        ret_dict['state'] = "ABSENT"
        return ret_dict

    ret_dict['id'] = arg_osimage_facts['id']
    ret_dict['name'] = arg_osimage_facts['name']
    ret_dict['size'] = arg_osimage_facts['size']
    ret_dict['type'] = arg_osimage_facts['type']
    ret_dict['state'] = arg_osimage_facts['status']

    return ret_dict