def access(value, key):
    """Gets a specified key out of a specified collection."""
    # if the collection is a list and the key is an index, make sure we don't go out of bounds
    if isinstance(value, list):
        key %= len(value)
    return value[key]