i'm not sure what you were looking at, but the very link you sent shows how to submit a string based request of "1 + 1". just change that script to whatever gremlin you intend to send to CosmosDB....there's not much more to it.
TinkerPop itself has a gremlin-python:
While string based submission is fine, we are recommending use of the Traversal API so that you can write Gremlin in python itself and avoid having to embed query strings in your code. You can read more about that here:
I would think that CosmosDB would support that as I thought any TinkerPop-enabled drivers should connect to it's Gremlin Server instance, but I've never tried it myself.