Is there a way to measure cell line similarity using python?
At its current form, your question is not clear, for example which aspects of these cell lines are your trying to compare?

Regarding your point on the ontologies, in Python you can use the pronto library to work with ontologies in OBO format.