def _get_encoding(encoding_or_label):
if hasattr(encoding_or_label, '<STR_LIT>'):<EOL><INDENT>return encoding_or_label<EOL><DEDENT>encoding = lookup(encoding_or_label)<EOL>if encoding is None:<EOL><INDENT>raise LookupError('<STR_LIT>' % encoding_or_label)<EOL><DEDENT>return encoding<EOL>
Accept either an encoding object or label.

:param encoding: An :class:`Encoding` object or a label string.
:returns: An :class:`Encoding` object.
:raises: :exc:`~exceptions.LookupError` for an unknown label.