How to select mobs?

I try to create a condition script through pyhton and i need selecting/targeting mobs even bot is not started. How can i do this?