grep; the basic usage is:
Here's a very simple example:
We might use this in
apeto color the labels for the tips of a tree depending on the origin of the sequence (say, database or patient sample).
In Python, you'd probably do something like this: