def pick(props, keys):
    """Returns a subset of properties given keys."""
    picked = {}
    for key in keys:
        if key not in props:
            raise KeyError('{} does not exist in properties'.format(repr(key)))
        picked[key] = props[key]
    return picked
