def check_extension(extension: str, allow_multifile: bool = False):
check_var(extension, var_types=str, var_name='<STR_LIT>')<EOL>if (extension.startswith(EXT_SEPARATOR) and extension.count(EXT_SEPARATOR) == <NUM_LIT:1>)or (allow_multifile and extension is MULTIFILE_EXT):<EOL><INDENT>pass<EOL><DEDENT>else:<EOL><INDENT>raise ValueError('<STR_LIT>' + EXT_SEPARATOR + '<STR_LIT>'<EOL>'<STR_LIT>' + EXT_SEPARATOR + '<STR_LIT>' + ('<STR_LIT>' + MULTIFILE_EXT + '<STR_LIT>'<EOL>'<STR_LIT>' if allow_multifile else '<STR_LIT>'))<EOL><DEDENT>
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: