# Buggy code
def find(self, module_name):
    for finder in self.finders:
        section = finder.find(module_name)
        if section is not None:
            return section


# Traceback (pip._internal.exceptions.InstallationError)
$ isort
Traceback (most recent call last):
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 93, in __init__
req = REQUIREMENT.parseString(requirement_string)
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1814, in parseString
raise exc
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1804, in parseString
loc, tokens = self._parse( instring, 0 )
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1548, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3722, in parseImpl
loc, exprtokens = e._parse( instring, loc, doActions )
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 1552, in _parseNoCache
loc,tokens = self.parseImpl( instring, preloc, doActions )
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/pyparsing.py", line 3502, in parseImpl
raise ParseException(instring, loc, self.errmsg, self)
pip._vendor.pyparsing.ParseException: Expected stringEnd (at char 7), (line:1, col:8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_internal/req/constructors.py", line 285, in install_req_from_line
req = Requirement(req_as_string)
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_vendor/packaging/requirements.py", line 97, in __init__
requirement_string[e.loc : e.loc + 8], e.msg
pip._vendor.packaging.requirements.InvalidRequirement: Parse error at "'otherwis'": Expected stringEnd

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/vagrant/python/bin/isort", line 10, in <module>
sys.exit(main())
File "/home/vagrant/python/lib/python3.6/site-packages/isort/main.py", line 348, in main
for sort_attempt in attempt_iterator:
File "/home/vagrant/python/lib/python3.6/site-packages/isort/main.py", line 346, in <genexpr>
attempt_iterator = (sort_imports(file_name, **arguments) for file_name in file_names)
File "/home/vagrant/python/lib/python3.6/site-packages/isort/main.py", line 86, in sort_imports
result = SortImports(file_name, **arguments)
File "/home/vagrant/python/lib/python3.6/site-packages/isort/isort.py", line 141, in __init__
self.finder = FindersManager(config=self.config, sections=self.sections)
File "/home/vagrant/python/lib/python3.6/site-packages/isort/finders.py", line 326, in __init__
self.finders = tuple(finder(config, sections) for finder in self.finders)
File "/home/vagrant/python/lib/python3.6/site-packages/isort/finders.py", line 326, in <genexpr>
self.finders = tuple(finder(config, sections) for finder in self.finders)
File "/home/vagrant/python/lib/python3.6/site-packages/isort/finders.py", line 184, in __init__
self.names = self._load_names()
File "/home/vagrant/python/lib/python3.6/site-packages/isort/finders.py", line 206, in _load_names
for name in self._get_names(path):
File "/home/vagrant/python/lib/python3.6/site-packages/isort/finders.py", line 288, in _get_names
for req in requirements:
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_internal/req/req_file.py", line 112, in parse_requirements
for req in req_iter:
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_internal/req/req_file.py", line 193, in process_line
isolated=isolated, options=req_options, wheel_cache=wheel_cache
File "/home/vagrant/python/lib/python3.6/site-packages/pip/_internal/req/constructors.py", line 296, in install_req_from_line
"Invalid requirement: '%s'\n%s" % (req_as_string, add_msg)
pip._internal.exceptions.InstallationError: Invalid requirement: 'Unless otherwise stated, this license applies to all files contained'

# Fixed code
def find(self, module_name):
    for finder in self.finders:
        try:
            section = finder.find(module_name)
        except Exception as exception:
            # isort has to be able to keep trying to identify the correct import section even if one approach fails
            if config.get("verbose", False):
                print(
                    "{} encountered an error ({}) while trying to identify the {} module".format(
                        finder.__name__, str(exception), module_name
                    )
                )
        if section is not None:
            return section