def coding_spec(str):
    # Only consider the first two lines
    lst = str.split("\n", 2)[:2]
    for line in lst:
        match = coding_re.match(line)
        if match is not None:
            break
        if not blank_re.match(line):
            return None
    else:
        return None
    name = match.group(1)
    # Check whether the encoding is known
    import codecs
    try:
        codecs.lookup(name)
    except LookupError:
        # The standard encoding error does not indicate the encoding
        raise LookupError, "Unknown encoding "+name
    return name
Return the encoding declaration according to PEP 263.
dataset/ETHPy150Open francelabs/datafari/windows/python/Lib/idlelib/IOBinding.py/coding_spec