def get_object_type_by_name(
    object_type_name: bytes,
) -> Union[Type["Commit"], Type["TagObject"], Type["Tree"], Type["Blob"]]:
    """Retrieve the Python class GitPython uses to represent a kind of Git object.

    :return:
        A type suitable to handle the given as `object_type_name`.
        This type can be called create new instances.

    :param object_type_name:
        Member of :attr:`Object.TYPES <git.objects.base.Object.TYPES>`.

    :raise ValueError:
        If `object_type_name` is unknown.
    """
    if object_type_name == b"commit":
        from . import commit

        return commit.Commit
    elif object_type_name == b"tag":
        from . import tag

        return tag.TagObject
    elif object_type_name == b"blob":
        from . import blob

        return blob.Blob
    elif object_type_name == b"tree":
        from . import tree

        return tree.Tree
    else:
        raise ValueError("Cannot handle unknown object type: %s" % object_type_name.decode())
Retrieve the Python class GitPython uses to represent a kind of Git object.

    :return:
        A type suitable to handle the given as `object_type_name`.
        This type can be called create new instances.

    :param object_type_name:
        Member of :attr:`Object.TYPES <git.objects.base.Object.TYPES>`.

    :raise ValueError:
        If `object_type_name` is unknown.
    
git/objects/util.py