human
Complete this python program:
def _assemble_from_unit_mappings(arg, errors):
assistant
#Here is the Python code you requested.

    """assemble the unit specifed fields from the arg (DataFrame)
    Return a Series for actual parsing
    Parameters
    arg : DataFrame
    errors : {\ignore\, \raise\, \coerce\}, default \raise\
    - If \raise\, then invalid parsing will raise an exception
    - If \coerce\, then invalid parsing will be set as NaT
    - If \ignore\, then invalid parsing will return the input
    Returns
    Series
    """
    from pandas import to_timedelta, to_numeric, DataFrame
    arg = DataFrame(arg)
    if (not arg.columns.is_unique):
        raise ValueError('cannot    assemble    with    duplicate    keys')
    def f(value):
        if (value in _unit_map):
            return _unit_map[value]
        if (value.lower() in _unit_map):
            return _unit_map[value.lower()]
        return value
    unit = {k: f(k) for k in arg.keys()}
    unit_rev = {v: k for (k, v) in unit.items()}
    required = ['year', 'month', 'day']
    req = sorted(list((set(required) - set(unit_rev.keys()))))
    if len(req):
        raise ValueError('to    assemble    mappings    requires    at    least    that    [year,    month,    day]    be    specified:    [{0}]    is    missing'.format(','.join(req)))
    excess = sorted(list((set(unit_rev.keys()) - set(_unit_map.values()))))
    if len(excess):
        raise ValueError('extra    keys    have    been    passed    to    the    datetime    assemblage:    [{0}]'.format(','.join(excess)))
    def coerce(values):
        values = to_numeric(values, errors=errors)
        if is_integer_dtype(values):
            values = values.astype('int64', copy=False)
        return values
    values = (((coerce(arg[unit_rev['year']]) * 10000) + (coerce(arg[unit_rev['month']]) * 100)) + coerce(arg[unit_rev['day']]))
    try:
        values = to_datetime(values, format='%Y%m%d', errors=errors)
    except (TypeError, ValueError) as e:
        raise ValueError('cannot    assemble    the    datetimes:    {0}'.format(e))
    for u in ['h', 'm', 's', 'ms', 'us', 'ns']:
        value = unit_rev.get(u)
        if ((value is not None) and (value in arg)):
            try:
                values += to_timedelta(coerce(arg[value]), unit=u, errors=errors)
            except (TypeError, ValueError) as e:
                raise ValueError('cannot    assemble    the    datetimes    [{0}]:    {1}'.format(value, e))
    return values