def geom_length(geom):
if geom.geom_type == '<STR_LIT>':<EOL><INDENT>return <NUM_LIT:1><EOL><DEDENT>if hasattr(geom, '<STR_LIT>'):<EOL><INDENT>geom = geom.exterior<EOL><DEDENT>if not geom.geom_type.startswith('<STR_LIT>') and hasattr(geom, '<STR_LIT>'):<EOL><INDENT>return len(geom.array_interface_base['<STR_LIT:data>'])//<NUM_LIT:2><EOL><DEDENT>else:<EOL><INDENT>length = <NUM_LIT:0><EOL>for g in geom:<EOL><INDENT>length += geom_length(g)<EOL><DEDENT>return length<EOL><DEDENT>
Calculates the length of coordinates in a shapely geometry.