import re


def bitdepthof(pixel) :
    """Return the bitdepth for a Plan9 pixel format string."""

    maxd = 0
    for c in re.findall(r'[a-z]\d*', pixel) :
        if c[0] != 'x':
            maxd = max(maxd, int(c[1:]))
    return maxd