# Buggy code
def try_import(objname):
    # type: (unicode) -> Any
    """Import a object or module using *name* and *currentmodule*.
    *name* should be a relative name from *currentmodule* or
    a fully-qualified name.

    Returns imported object or module.  If failed, returns None value.
    """
    try:
        __import__(objname)
        return sys.modules.get(objname)  # type: ignore
    except ImportError:
        modname, attrname = module_sig_re.match(objname).groups()  # type: ignore
        if modname is None:
            return None
        try:
            __import__(modname)
            return getattr(sys.modules.get(modname), attrname, None)
        except ImportError:
            return None


# Traceback (ModuleNotFoundError)
# Sphinx version: 1.6.3
# Python version: 3.6.0 (CPython)
# Docutils version: 0.14
# Jinja2 version: 2.9.6
# Last messages:
#   updating environment:
#
#   [extensions changed] 8 added, 0 changed, 0 removed
#
#   reading sources... [ 12%] aus
#
#   base-path: /home/user/some
#
#   reading sources... [ 25%] fileformat
#
# Loaded extensions:
#   alabaster (0.7.10) from /home/johannes/anaconda3/lib/python3.6/site-packages/alabaster/__init__.py
#   sphinx.ext.autodoc (1.6.3) from /home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/autodoc.py
#   sphinx.ext.graphviz (1.6.3) from /home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/graphviz.py
#   sphinx.ext.inheritance_diagram (1.6.3) from /home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py
Traceback (most recent call last):
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py", line 80, in try_import
__import__(objname)
ModuleNotFoundError: No module named '.'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/cmdline.py", line 306, in main
app.build(opts.force_all, filenames)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/application.py", line 339, in build
self.builder.build_update()
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 326, in build_update
self.build(['__all__'], to_build)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/builders/__init__.py", line 344, in build
updated_docnames = set(self.env.update(self.config, self.srcdir, self.doctreedir))
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 583, in update
self._read_serial(docnames, self.app)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 602, in _read_serial
self.read_doc(docname, app)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/environment/__init__.py", line 723, in read_doc
pub.publish()
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/core.py", line 217, in publish
self.settings)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/io.py", line 74, in read
self.parse()
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/readers/__init__.py", line 78, in parse
self.parser.parse(self.input, document)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/__init__.py", line 191, in parse
self.statemachine.run(inputlines, document, inliner=self.inliner)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 171, in run
input_source=document['source'])
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2753, in underline
self.section(title, source, style, lineno - 1, messages)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 327, in section
self.new_subsection(title, lineno, messages)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 395, in new_subsection
node=section_node, match_titles=True)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 282, in nested_parse
node=node, match_titles=match_titles)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 196, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2328, in explicit_markup
self.explicit_list(blank_finish)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2358, in explicit_list
match_titles=self.state_machine.match_titles)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 319, in nested_list_parse
node=node, match_titles=match_titles)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 196, in run
results = StateMachineWS.run(self, input_lines, input_offset)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/statemachine.py", line 239, in run
context, state, transitions)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/statemachine.py", line 460, in check_line
return method(match, context, next_state)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2631, in explicit_markup
nodelist, blank_finish = self.explicit_construct(match)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2338, in explicit_construct
return method(self, expmatch)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2081, in directive
directive_class, match, type_name, option_presets)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/docutils/parsers/rst/states.py", line 2130, in run_directive
result = directive_instance.run()
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py", line 342, in run
private_bases='private-bases' in self.options)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py", line 144, in __init__
classes = self._import_classes(class_names, currmodule)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py", line 156, in _import_classes
classes.extend(import_classes(name, currmodule))
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py", line 100, in import_classes
target = try_import(currmodule + '.' + name)
File "/home/johannes/anaconda3/lib/python3.6/site-packages/sphinx/ext/inheritance_diagram.py", line 83, in try_import
modname, attrname = module_sig_re.match(objname).groups()  # type: ignore
AttributeError: 'NoneType' object has no attribute 'groups'

# Fixed code
def try_import(objname):
    # type: (unicode) -> Any
    """Import a object or module using *name* and *currentmodule*.
    *name* should be a relative name from *currentmodule* or
    a fully-qualified name.

    Returns imported object or module.  If failed, returns None value.
    """
    try:
        __import__(objname)
        return sys.modules.get(objname)  # type: ignore
    except (ImportError, ValueError):  # ValueError,py27 -> ImportError,py3
        matched = module_sig_re.match(objname)  # type: ignore

        if not matched:
            return None

        modname, attrname = matched.groups()

        if modname is None:
            return None
        try:
            __import__(modname)
            return getattr(sys.modules.get(modname), attrname, None)
        except (ImportError, ValueError):  # ValueError,py27 -> ImportError,py3
            return None