@ilwdchar_compat<EOL>def read_ligolw(source, contenthandler=LIGOLWContentHandler, **kwargs):
from ligo.lw.ligolw import Document<EOL>from ligo.lw import types<EOL>from ligo.lw.lsctables import use_in<EOL>from ligo.lw.utils import (load_url, ligolw_add)<EOL>topytype = types.ToPyType.copy()<EOL>for key in types.ToPyType:<EOL><INDENT>if key in types.ToNumPyType:<EOL><INDENT>types.ToPyType[key] = numpy.dtype(types.ToNumPyType[key]).type<EOL><DEDENT><DEDENT>contenthandler = use_in(contenthandler)<EOL>source = file_list(source)<EOL>try:<EOL><INDENT>if len(source) == <NUM_LIT:1>:<EOL><INDENT>return load_url(<EOL>source[<NUM_LIT:0>],<EOL>contenthandler=contenthandler,<EOL>**kwargs<EOL>)<EOL><DEDENT>return ligolw_add.ligolw_add(<EOL>Document(),<EOL>source,<EOL>contenthandler=contenthandler,<EOL>**kwargs<EOL>)<EOL><DEDENT>except LigolwElementError as exc:<EOL><INDENT>if LIGO_LW_COMPAT_ERROR.search(str(exc)):<EOL><INDENT>try:<EOL><INDENT>return read_ligolw(<EOL>source,<EOL>contenthandler=contenthandler,<EOL>ilwdchar_compat=True,<EOL>**kwargs<EOL>)<EOL><DEDENT>except Exception:  <EOL><INDENT>pass<EOL><DEDENT><DEDENT>raise<EOL><DEDENT>finally:  <EOL><INDENT>types.ToPyType = topytype<EOL><DEDENT>
Read one or more LIGO_LW format files

    Parameters
    ----------
    source : `str`, `file`
        the open file or file path to read

    contenthandler : `~xml.sax.handler.ContentHandler`, optional
        content handler used to parse document

    verbose : `bool`, optional
        be verbose when reading files, default: `False`

    Returns
    -------
    xmldoc : :class:`~ligo.lw.ligolw.Document`
        the document object as parsed from the file(s)