# Buggy code
def _format_option_value(optdict, value):
    """return the user input's value from a 'compiled' value"""
    if isinstance(value, (list, tuple)):
        value = ",".join(value)
    elif isinstance(value, dict):
        value = ",".join("%s:%s" % (k, v) for k, v in value.items())
    elif hasattr(value, "match"):  # optdict.get('type') == 'regexp'
        # compiled regexp
        value = value.pattern
    elif optdict.get("type") == "yn":
        value = value and "yes" or "no"
    elif isinstance(value, six.string_types) and value.isspace():
        value = "'%s'" % value
    return value


# Traceback (TypeError)
$ pylint
[working help output]
$ pylint --ignore-patterns=.*_pb2.py
No config file found, using default configuration
Traceback (most recent call last):
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/bin/pylint", line 11, in <module>
sys.exit(run_pylint())
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/local/lib/python2.7/site-packages/pylint/__init__.py", line 11, in run_pylint
Run(sys.argv[1:])
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/local/lib/python2.7/site-packages/pylint/lint.py", line 1289, in __init__
print(linter.help())
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/local/lib/python2.7/site-packages/pylint/config.py", line 692, in help
return self.cmdline_parser.format_help()
File "/usr/lib/python2.7/optparse.py", line 1650, in format_help
result.append(self.format_option_help(formatter))
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/local/lib/python2.7/site-packages/pylint/config.py", line 321, in format_option_help
result.append(group.format_help(formatter))
File "/usr/lib/python2.7/optparse.py", line 1114, in format_help
result += OptionContainer.format_help(self, formatter)
File "/usr/lib/python2.7/optparse.py", line 1085, in format_help
result.append(self.format_option_help(formatter))
File "/usr/lib/python2.7/optparse.py", line 1074, in format_option_help
result.append(formatter.format_option(option))
File "/usr/lib/python2.7/optparse.py", line 316, in format_option
help_text = self.expand_default(option)
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/local/lib/python2.7/site-packages/pylint/config.py", line 234, in _expand_default
value = utils._format_option_value(optdict, value)
File "/home/rcardona/.virtualenvs/tmp-4658876925714861/local/lib/python2.7/site-packages/pylint/utils.py", line 1092, in _format_option_value
value = ','.join(value)
TypeError: sequence item 0: expected string, _sre.SRE_Pattern found

# Fixed code
def _format_option_value(optdict, value):
    """return the user input's value from a 'compiled' value"""
    if isinstance(value, (list, tuple)):
        value = ",".join(_format_option_value(optdict, item) for item in value)
    elif isinstance(value, dict):
        value = ",".join("%s:%s" % (k, v) for k, v in value.items())
    elif hasattr(value, "match"):  # optdict.get('type') == 'regexp'
        # compiled regexp
        value = value.pattern
    elif optdict.get("type") == "yn":
        value = value and "yes" or "no"
    elif isinstance(value, six.string_types) and value.isspace():
        value = "'%s'" % value
    return value