def pop_options(options, names):
    """options is a dictionary; names is a list of keys.
    Remove the given keys from options and
    return a new dictionary with those key-value pairs.
    """
    new = {}
    for name in names:
        if name in options:
            new[name] = options.pop(name)
    return new