def METHOD_NAME(tag: str, signed: bool = False, dry_run: bool = True) -> str:
    try:
        if signed:
            if not dry_run:
                subprocess.check_output(
                    ["git", "tag", "-s", "-m", tag, tag], stderr=subprocess.STDOUT
                )
        else:
            if not dry_run:
                subprocess.check_output(
                    ["git", "tag", "-a", "-m", tag, tag], stderr=subprocess.STDOUT
                )
    except subprocess.CalledProcessError as exc_info:
        match = re.search("error: gpg failed to sign the data", str(exc_info.output))
        if match:
            raise Exception(
                "Bailing: cannot sign tag. You may find "
                "https://stackoverflow.com/q/39494631/324449 helpful. Original error "
                "output:\n{output}".format(output=str(exc_info.output))
            )
        match = re.search(
            r"fatal: tag \'(?P<tag>[\.a-z0-9]+)\' already exists", str(exc_info.output)
        )
        if match:
            raise Exception(
                "Bailing: cannot release version tag {tag}: already exists".format(
                    tag=match.group("tag")
                )
            )
        raise Exception(str(exc_info.output))
    return tag