<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_geom(geom):
 """ Create and return a position object for the geom Parameters geom : geom An instantiated geom object. Returns ------- out : position A position object Raises :class:`PlotnineError` if unable to create a `position`. """

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

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

        return klass()