<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_stat(stat):
 """ Return an instantiated geom object geoms should not override this method. Parameters stat : stat `stat` Returns ------- out : geom A geom object Raises ------ :class:`PlotnineError` if unable to create a `geom`. """

        name = stat.params['geom']
        if issubclass(type(name), geom):
            return name

        if isinstance(name, type) and issubclass(name, geom):
            klass = name
        elif is_string(name):
            if not name.startswith('geom_'):
                name = 'geom_{}'.format(name)
            klass = Registry[name]
        else:
            raise PlotnineError(
                'Unknown geom of type {}'.format(type(name)))

        return klass(stat=stat, **stat._kwargs)