def dominates(p, q):
    """
    Test for path domination.  An individual path element *a*
    dominates another path element *b*, written as *a* >= *b* if
    either *a* == *b* or *a* is a wild card.  A path *p* = *p1*, *p2*,
    ..., *pn* dominates another path *q* = *q1*, *q2*, ..., *qm* if
    *n* == *m* and, for all *i*, *pi* >= *qi*.

    """
    return len(p) == len(q) and all(map(lambda es: es[0] == es[1] or es[0] ==
        '*', zip(p, q)))
