<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def net2str(net, outSTRM):
 """ Writes the network object given as "inpNET" as a .str file readable by PHEM. Returns a map from the SUMO-road id to the generated numerical id used by PHEM. The following may be a matter of changes: - currently, only the positions of the start and the end nodes are written, the geometry of the edge as defined in the SUMO-network is not exported. A map between the edge id and a segment to a numerical id would be necessary """

    if outSTRM is not None:
        print("Str-Id,Sp,SegAnX,SegEnX,SegAnY,SegEnY", file=outSTRM)
    sIDm = sumolib._Running()
    for e in net._edges:
        eid = sIDm.g(e._id)
        if outSTRM is not None:
            c1 = e._from._coord
            c2 = e._to._coord
            print("%s,%s,%s,%s,%s,%s" %
                  (eid, len(e._lanes), c1[0], c2[0], c1[1], c2[1]), file=outSTRM)
    return sIDm