Checks to see if the specific apache mod is enabled.

    This will only be functional on operating systems that support
    `a2enmod -l` to list the enabled mods.

    CLI Example:

    .. code-block:: bash

        salt '*' apache.check_mod_enabled status

def check_mod_enabled(mod):
    '''
    Checks to see if the specific apache mod is enabled.

    This will only be functional on operating systems that support
    `a2enmod -l` to list the enabled mods.

    CLI Example:

    .. code-block:: bash

        salt '*' apache.check_mod_enabled status
    '''
    if mod.endswith('.load') or mod.endswith('.conf'):
        mod_name = mod[:-5]
    else:
        mod_name = mod

    cmd = 'a2enmod -l'
    try:
        active_mods = __salt__['cmd.run'](cmd, python_shell=False).split(' ')
    except Exception as e:
        return e

    return mod_name in active_mods