def lookup(label):
<EOL>label = ascii_lower(label.strip('<STR_LIT>'))<EOL>name = LABELS.get(label)<EOL>if name is None:<EOL><INDENT>return None<EOL><DEDENT>encoding = CACHE.get(name)<EOL>if encoding is None:<EOL><INDENT>if name == '<STR_LIT>':<EOL><INDENT>from .x_user_defined import codec_info<EOL><DEDENT>else:<EOL><INDENT>python_name = PYTHON_NAMES.get(name, name)<EOL>codec_info = codecs.lookup(python_name)<EOL><DEDENT>encoding = Encoding(name, codec_info)<EOL>CACHE[name] = encoding<EOL><DEDENT>return encoding<EOL>
Look for an encoding by its label.
This is the spec’s `get an encoding
<http://encoding.spec.whatwg.org/#concept-encoding-get>`_ algorithm.
Supported labels are listed there.

:param label: A string.
:returns:
    An :class:`Encoding` object, or :obj:`None` for an unknown label.