# Buggy code
def validate_extension(extension):
    """Verify extension's dependencies and environment.

    :param extensions: an extension to check
    :returns: if extension should be run
    """

    logger.debug("Validating extension: %s", extension.ext_name)

    if extension.ext_name != extension.entry_point.name:
        logger.warning(
            "Disabled extension %(ep)s: entry point name (%(ep)s) "
            "does not match extension name (%(ext)s)",
            {"ep": extension.entry_point.name, "ext": extension.ext_name},
        )
        return False

    try:
        extension.entry_point.require()
    except pkg_resources.DistributionNotFound as ex:
        logger.info(
            "Disabled extension %s: Dependency %s not found", extension.ext_name, ex
        )
        return False
    except pkg_resources.VersionConflict as ex:
        found, required = ex.args
        logger.info(
            "Disabled extension %s: %s required, but found %s at %s",
            extension.ext_name,
            required,
            found,
            found.location,
        )
        return False

    try:
        extension.validate_environment()
    except exceptions.ExtensionError as ex:
        logger.info("Disabled extension %s: %s", extension.ext_name, ex.message)
        return False

    return True


# Traceback (ValueError)
2014-12-15 19:54:53,052 INFO [7923:MainThread] mopidy.__main__: Starting Mopidy 0.19.4
2014-12-15 19:54:53,433 INFO [7923:MainThread] mopidy.config: Loading config from: builtin defaults, /usr/share/mopidy/conf.d, /etc/mopidy/mopidy.conf, command line options
2014-12-15 19:54:54,860 ERROR [7923:MainThread] mopidy.__main__: need more than 1 value to unpack
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/mopidy/__main__.py", line 79, in main
if not ext.validate_extension(extension):
File "/usr/local/lib/python2.7/dist-packages/mopidy/ext.py", line 190, in validate_extension
found, required = ex.args
ValueError: need more than 1 value to unpack

# Fixed code
def validate_extension(extension):
    """Verify extension's dependencies and environment.

    :param extensions: an extension to check
    :returns: if extension should be run
    """

    logger.debug("Validating extension: %s", extension.ext_name)

    if extension.ext_name != extension.entry_point.name:
        logger.warning(
            "Disabled extension %(ep)s: entry point name (%(ep)s) "
            "does not match extension name (%(ext)s)",
            {"ep": extension.entry_point.name, "ext": extension.ext_name},
        )
        return False

    try:
        extension.entry_point.require()
    except pkg_resources.DistributionNotFound as ex:
        logger.info(
            "Disabled extension %s: Dependency %s not found", extension.ext_name, ex
        )
        return False
    except pkg_resources.VersionConflict as ex:
        if len(ex.args) == 2:
            found, required = ex.args
            logger.info(
                "Disabled extension %s: %s required, but found %s at %s",
                extension.ext_name,
                required,
                found,
                found.location,
            )
        else:
            logger.info("Disabled extension %s: %s", extension.ext_name, ex)
        return False

    try:
        extension.validate_environment()
    except exceptions.ExtensionError as ex:
        logger.info("Disabled extension %s: %s", extension.ext_name, ex.message)
        return False

    return True