<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def reflect(cls, X, **kwargs):
 """Reflect is for visitors where you are exposing some information about the types reachable from a starting type to an external system. For example, a front-end, a REST URL router and documentation framework, an avro schema definition, etc. X can be a type or an instance. This API should be considered **experimental** """

        if isinstance(X, type):
            value = None
            value_type = X
        else:
            value = X
            value_type = type(X)
        if not issubclass(value_type, Record):
            raise TypeError("Cannot reflect on %s" % value_type.__name__)

        visitor = cls.Visitor(
            cls.scantypes, cls.propinfo, cls.itemtypes,
            cls.typeinfo,
            **kwargs)

        return cls.map(visitor, value, value_type)