Writing a function to parse custom topologiesΒΆ