def _extract_md_matches(md, maxlength):
    md_pos = 0

    while md and md_pos < maxlength:
        tmp = '0'  # preload a zero so that immediate mismatches will be caught
                   # the zero will have no affect otherwise...

        # look for matches
        while md and '0123456789' in md[0]:
            tmp += md[0]
            md = md[1:]

        pos = int(tmp)
        if pos > maxlength:
            return (maxlength, '%s%s' % (pos - maxlength, md))
        return (pos, md)
dataset/ETHPy150Open ngsutils/ngsutils/ngsutils/bam/__init__.py/_extract_md_matches/swapped operands of `in`