<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def filter_index(collection, predicate=None, index=None):
 """ Filter collection with predicate function and index. If index is not found, returns None. :param collection: :type collection: collection supporting iteration and slicing :param predicate: function to filter the collection with :type predicate: function :param index: position of a single element to retrieve :type index: int :return: filtered list, or single element of filtered list if index is defined :rtype: list or object """

    if index is None and isinstance(predicate, int):
        index = predicate
        predicate = None
    if predicate:
        collection = collection.__class__(filter(predicate, collection))
    if index is not None:
        try:
            collection = collection[index]
        except IndexError:
            collection = None
    return collection