<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def flatten_reducer( flattened_list: list, entry: typing.Union[list, tuple, COMPONENT] ) -> list: """ Flattens a list of COMPONENT instances to remove any lists or tuples of COMPONENTS contained within the list :param flattened_list: The existing flattened list that has been populated from previous calls of this reducer function :param entry: An entry to be reduced. Either a COMPONENT instance or a list/tuple of COMPONENT instances :return: The flattened list with the entry flatly added to it """


    if hasattr(entry, 'includes') and hasattr(entry, 'files'):
        flattened_list.append(entry)
    elif entry:
        flattened_list.extend(entry)
    return flattened_list