from typing import OrderedDict


def _remove_none(data):
    """
    Go thru `data` (dict / list) and remove ``None`` values.
    """
    if isinstance(data, list) or isinstance(data, tuple):
        return [x for x in data if x is not None]

    out = OrderedDict()
    for key, val in data.iteritems():
        if val is not None:
            out[key] = val

    return out