import re


def _parse_line(cpuid, match):
    """Search a line with the content <match>: <value> in the given
    StringIO instance and return <value>

    """
    cpuid.seek(0)
    for l in cpuid.readlines():
        m = re.match('^(%s.*):\s+(.+)' % match, l)
        if m:
            return (m.group(1), m.group(2).rstrip())

    return (None, None)