def cast_to_route_factory(in_arg):
    from meta import MetaApplication
    if isinstance(in_arg, BaseRoute):
        return in_arg
    elif isinstance(in_arg, Sequence):
        try:
            if in_arg[1] is MetaApplication:
                raise ValueError(_meta_exc_msg)
            if isinstance(in_arg[1], BaseApplication):
                return SubApplication(*in_arg)
            if callable(in_arg[1]):
                return Route(*in_arg)
        except __HOLE__:
            pass
    raise TypeError('Could not create route from %r' % (in_arg,))
dataset/ETHPy150Open mahmoud/clastic/clastic/application.py/cast_to_route_factory