<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def enum_mux(cntrl, table, default=None, strict=True):
 """ Build a mux for the control signals specified by an enum. :param cntrl: is a wirevector and control for the mux. :param table: is a dictionary of the form mapping enum->wirevector. :param default: is a wirevector to use when the key is not present. In addtion it is possible to use the key 'otherwise' to specify a default value, but it is an error if both are supplied. :param strict: is flag, that when set, will cause enum_mux to check that the dictionary has an entry for every possible value in the enum. Note that if a default is set, then this check is not performed as the default will provide valid values for any underspecified keys. :return: a wirevector which is the result of the mux. :: class Command(Enum):
 ADD = 1 SUB = 2 enum_mux(cntrl, {ADD: a+b, SUB: a-b}) enum_mux(cntrl, {ADD: a+b}, strict=False) # SUB case undefined enum_mux(cntrl, {ADD: a+b, otherwise: a-b}) enum_mux(cntrl, {ADD: a+b}, default=a-b) """

    # check dictionary keys are of the right type
    keytypeset = set(type(x) for x in table.keys() if x is not otherwise)
    if len(keytypeset) != 1:
        raise PyrtlError('table mixes multiple types {} as keys'.format(keytypeset))
    keytype = list(keytypeset)[0]
    # check that dictionary is complete for the enum
    try:
        enumkeys = list(keytype.__members__.values())
    except AttributeError:
        raise PyrtlError('type {} not an Enum and does not support the same interface'
                         .format(keytype))
    missingkeys = [e for e in enumkeys if e not in table]

    # check for "otherwise" in table and move it to a default
    if otherwise in table:
        if default is not None:
            raise PyrtlError('both "otherwise" and default provided to enum_mux')
        else:
            default = table[otherwise]

    if strict and default is None and missingkeys:
        raise PyrtlError('table provided is incomplete, missing: {}'.format(missingkeys))

    # generate the actual mux
    vals = {k.value: d for k, d in table.items() if k is not otherwise}
    if default is not None:
        vals['default'] = default
    return muxes.sparse_mux(cntrl, vals)