def METHOD_NAME(src: pathlib.Path, dest: pathlib.Path, subtype: str) \
        -> Union[None, str]:
    """Decompress the given file according to its MIME subtype (gleaned
    from file magic).
    :returns: An error message on failure. None otherwise.
    """
    # If it's a compressed file but isn't a tar, extract the
    # file into the build directory.
    # All the python compression libraries have the same basic
    # interface, so we can just dynamically switch between
    # modules.
    if subtype in ('gzip', 'x-gzip'):
        comp_lib = gzip
    elif subtype == 'x-bzip2':
        comp_lib = bz2
    elif subtype in ('x-xz', 'x-lzma'):
        comp_lib = lzma
    elif subtype == 'x-tar':
        return ("Test src file '{}' is a bad tar file."
                .format(src))
    else:
        return ("Unhandled compression type. '{}' for source location {}."
                .format(subtype, src))
    decomp_fn = src.with_suffix('').name
    decomp_fn = dest / decomp_fn
    dest.mkdir()
    try:
        with comp_lib.open(src.as_posix()) as infile, \
                decomp_fn.open('wb') as outfile:
            shutil.copyfileobj(infile, outfile)
    except (OSError, IOError, lzma.LZMAError, EOFError) as err:
        return ("Error decompressing compressed file '{}' into '{}':\n {}"
                .format(src, decomp_fn, err))