def get_or_create_organisation_hubspot_id(
        self,
        user: FFAdminUser,
        organisation: Organisation = None,  # type: ignore[assignment]
    ) -> str:
        """
        Return the Hubspot API's id for an organisation.
        """
        if organisation and getattr(organisation, "hubspot_organisation", None):
            return organisation.hubspot_organisation.hubspot_id

        if user.email_domain in settings.HUBSPOT_IGNORE_ORGANISATION_DOMAINS:
            domain = None
        else:
            domain = user.email_domain

        if organisation:
            response = self.client.create_company(
                name=organisation.name,
                active_subscription=organisation.subscription.plan,
                organisation_id=organisation.id,
                domain=domain,
            )

            # Store the organisation data in the database since we are
            # unable to look them up via a unique identifier.
            HubspotOrganisation.objects.create(
                organisation=organisation,
                hubspot_id=response["id"],
            )
        else:
            response = self._get_or_create_company_by_domain(domain)  # type: ignore[arg-type]

        return response["id"]  # type: ignore[no-any-return]

        Return the Hubspot API's id for an organisation.
        
api/integrations/lead_tracking/hubspot/lead_tracker.py