def METHOD_NAME(
    output: Optional[str],
    name: Optional[str] = None,
    version: Optional[str] = None,
    target_arch: Optional[str] = None,
) -> Optional[str]:
    """Get output filename of the snap file.
    If `output` is not a file, then the filename will be <name>_<version>_<target_arch>.snap
    :param output: Snap file name or directory.
    :param name: Name of snap project.
    :param version: Version of snap project.
    :param target_arch: Target architecture the snap project is built to.
    :return: The filename of the snap file if output or name/version/target_arch are specified.
    """
    if output:
        output_path = Path(output)
        if not output_path.is_dir():
            return output_path.name
    if all(i is not None for i in [name, version, target_arch]):
        return f"{name}_{version}_{target_arch}.snap"
    return None