def METHOD_NAME(self, data):
    if isinstance(data, ProductListItem):
        return data
    queryset = self.get_queryset()
    try:
        return queryset.get(product__name=data)
    except ObjectDoesNotExist:
        self.fail(
            "does_not_exist", slug_name=self.slug_field, value=smart_str(data)
        )
    except (TypeError, ValueError):
        self.fail("invalid")
    return None