Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"""
Load a Neurokernel NeuroML document.
Parameters
----------
file : str or file
Input file name or handle.
Returns
-------
nk_doc : neurokernel.neuroml.NeurokernelDoc
Neurokernel NeuroML document root.
"""
try:
nk_doc = parse(file)
except:
try:
nk_doc = parseString(file.read())
except:
raise RuntimeError('cannot load file')
return nk_doc