def _create_rule(path, rule):
    # type: (List[Type[Rule]], Type[Rule]) -> Type[ReducedUnitRule]
    """
    Create ReducedUnitRule based on sequence of unit rules and end, generating rule.
    :param path: Sequence of unit rules.
    :param rule: Rule that is attached after sequence of unit rules.
    :return: ReducedUnitRule class.
    """
    created = type('Reduced[' + rule.__name__ + ']',
                   (ReducedUnitRule,),
                   ReducedUnitRule.__dict__.copy())  # type: Type[ReducedUnitRule]
    created.rule = ([path[0].fromSymbol], rule.right)
    created.end_rule = rule
    created.by_rules = path
    return created