Utility method to check that the provided extension is valid. Extension should either be MULTIFILE_EXT
    (='multifile') or start with EXT_SEPARATOR (='.') and contain only one occurence of EXT_SEPARATOR

    :param extension:
    :param allow_multifile:
    :return:

def check_extension(extension: str, allow_multifile: bool = False):
    """
    Utility method to check that the provided extension is valid. Extension should either be MULTIFILE_EXT
    (='multifile') or start with EXT_SEPARATOR (='.') and contain only one occurence of EXT_SEPARATOR

    :param extension:
    :param allow_multifile:
    :return:
    """
    check_var(extension, var_types=str, var_name='extension')

    # Extension should either be 'multifile' or start with EXT_SEPARATOR and contain only one EXT_SEPARATOR
    if (extension.startswith(EXT_SEPARATOR) and extension.count(EXT_SEPARATOR) == 1) \
            or (allow_multifile and extension is MULTIFILE_EXT):
        # ok
        pass
    else:
        raise ValueError('\'extension\' should start with \'' + EXT_SEPARATOR + '\' and contain not other '
                         'occurrence of \'' + EXT_SEPARATOR + '\'' + (', or be equal to \'' + MULTIFILE_EXT + '\' (for '
                         'multifile object parsing)' if allow_multifile else ''))