def _combine(lhs, rhs):
    """
    Combines a list, tuple, or dict, with another list or tuple or dict

    Build mode struct attributes are tuples by default, but many consumers
    use the 'create_build_mode' function to initialize them to lists, or
    even dictionaries. When combining build modes using the 'extend_build_mode'
    function, this helper function handles the case in which a list is
    extended with a tuple argument, or vice versa

    Args:
        lhs: A tuple, list, or dict
        rhs: A tuple, list, or dict to add to the left hand argument

    Returns:
        A value of the lhs argument's type, with the elements from the rhs
        added to it
    """
    if not rhs:
        return lhs

    # Note: 'isinstance' and 'issubclass' are not available in this environment,
    # so we check here for the exact type. Subclasses will not pass this check.
    if type(lhs) == type({}):
        result = {}
        result.update(lhs)
        result.update(rhs)
        return result
    elif type(lhs) == type([]):
        return lhs + list(rhs)
    elif type(lhs) == type(()):
        return lhs + tuple(rhs)
    return lhs + rhs