Since this is in Python, I assume you are doing this by code Polyline—Help | ArcGIS for Desktop using intersect in that class. You could follow this by a union. If the features are coming from two different feature classes, then the dissolve should work on that feature