Return information about physical and virtual memory on the system

    Returns:
        dict: A dictionary of information about memory on the system

    CLI Example:

    .. code-block:: bash

        salt * status.meminfo

def meminfo():
    '''
    Return information about physical and virtual memory on the system

    Returns:
        dict: A dictionary of information about memory on the system

    CLI Example:

    .. code-block:: bash

        salt * status.meminfo
    '''
    # Get physical memory
    vm_total, vm_available, vm_percent, vm_used, vm_free = psutil.virtual_memory()
    # Get swap memory
    swp_total, swp_used, swp_free, swp_percent, _, _ = psutil.swap_memory()

    def get_unit_value(memory):
        symbols = ('K', 'M', 'G', 'T', 'P', 'E', 'Z', 'Y')
        prefix = {}
        for i, s in enumerate(symbols):
            prefix[s] = 1 << (i + 1) * 10
        for s in reversed(symbols):
            if memory >= prefix[s]:
                value = float(memory) / prefix[s]
                return {'unit': s,
                        'value': value}
        return {'unit': 'B',
                'value': memory}

    return {'VmallocTotal': get_unit_value(vm_total),
            'VmallocUsed': get_unit_value(vm_used),
            'VmallocFree': get_unit_value(vm_free),
            'VmallocAvail': get_unit_value(vm_available),
            'SwapTotal': get_unit_value(swp_total),
            'SwapUsed': get_unit_value(swp_used),
            'SwapFree': get_unit_value(swp_free)}