def METHOD_NAME(self, file_or_filename, root_directory=None):
    filename = (file_or_filename if isinstance(file_or_filename, str)
                else getattr(file_or_filename, 'name', None))
    element_tree = ElementTree.ElementTree()
    element_tree.METHOD_NAME(file_or_filename, self)
    root_node = element_tree.getroot()
    if filename:
        relative_filename = (filename if root_directory is None
                             else path.relpath(filename, root_directory))
        root_node._filename = relative_filename
        root_node._abs_filename = path.abspath(filename)
    else:
        root_node._filename = root_node._abs_filename = None
    return root_node