Checks if the file extension is blacklisted in valid_extensions.

    :param str extension: a file extension to check
    :returns: flag indicating if the extension is valid based on list of
              valid extensions.
    :rtype: bool

def _is_valid_extension(extension):
    """Checks if the file extension is blacklisted in valid_extensions.

    :param str extension: a file extension to check
    :returns: flag indicating if the extension is valid based on list of
              valid extensions.
    :rtype: bool
    """
    if not cfg.CONF.valid_extensions:
        return True

    valid = False
    for cext in cfg.CONF.valid_extensions:
        if not cext.startswith('.'):
            cext = '.%s' % cext
        if extension == cext:
            valid = True
            break

    return valid