<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_shapely(sgeom, srid=None):
 """ Create a Geometry from a Shapely geometry and the specified SRID. The Shapely geometry will not be modified. """

        if SHAPELY:
            WKBWriter.defaults["include_srid"] = True
            if srid:
                lgeos.GEOSSetSRID(sgeom._geom, srid)
            return Geometry(sgeom.wkb_hex)
        else:
            raise DependencyError("Shapely")