import collections


def select_keys(dictionary, *keys):
    """
    Safely get a 'subset' of a dictionary. Ignore `keys` that don't exist in dictionary.

    E.g.,
    >>> d = {'a': 1, 'b': 2, 'c': 3}
    >>> select_keys(d, 'a')
    {'a': 1}
    >>> select_keys(d, 'a', 'b')
    {'a': 1, 'b': 2}
    >>> select_keys(d, 'a', 'unknown_key')
    {'a': 1}
    >>> select_keys({})
    {}
    >>> select_keys({'a': 1})
    {}

    Args:
        dictionary (dict): dictionary to get
        keys (*args): list of keys

    Returns:
        dictionary (dict): dictionary subset with just the given `keys` and their values
    """
    try:
        # We can handle different inputs as long as they are dict-like
        dictionary.items()
        dictionary.get('')
    except AttributeError:
        return None

    return dict(collections.OrderedDict({k: v for k, v in dictionary.items() if k in set(keys)}))