def _remove_empty(xs):
    """Remove null values in a nested set of arguments, eliminates unpassed values in S3.
    """
    if isinstance(xs, (list, tuple)):
        return filter(lambda x: x is not None, [_remove_empty(x) for x in xs])
    elif isinstance(xs, dict):
        out = {}
        for k, v in xs.items():
            v = _remove_empty(v)
            if v is not None:
                out[k] = v
        return out if out else None
    else:
        return xs
dataset/ETHPy150Open chapmanb/bcbio-nextgen-vm/bcbiovm/ship/pack.py/_remove_empty/original