def METHOD_NAME(cls, _, id) -> Optional[MT]:
    model = cls._meta.model
    type_name = cls._meta.name
    lookup = Q(pk=id)
    if id is not None and type_name in TYPES_WITH_DOUBLE_ID_AVAILABLE:
        # This is temporary solution that allows fetching orders with use of
        # new (uuid type) and old (int type) id
        try:
            UUID(str(id))
        except ValueError:
            lookup = (
                Q(number=id) & Q(use_old_id=True)
                if type_name == "Order"
                else Q(old_id=id) & Q(old_id__isnull=False)
            )
    try:
        return model.objects.get(lookup)
    except model.DoesNotExist:
        return None