def _get_by_ref_or_id(self, ref_or_id, exclude_fields=None, include_fields=None):
        """
        Retrieve resource object by an id of a reference.

        Note: This method throws StackStormDBObjectNotFoundError exception if the object is not
        found in the database.
        """

        if exclude_fields and include_fields:
            msg = (
                "exclude_fields and include_fields arguments are mutually exclusive. "
                "You need to provide either one or another, but not both."
            )
            raise ValueError(msg)

        if ResourceReference.is_resource_reference(ref_or_id):
            # references always contain a dot and id's can't contain it
            is_reference = True
        else:
            is_reference = False

        if is_reference:
            resource_db = self._get_by_ref(
                resource_ref=ref_or_id,
                exclude_fields=exclude_fields,
                include_fields=include_fields,
            )
        else:
            resource_db = self._get_by_id(
                resource_id=ref_or_id,
                exclude_fields=exclude_fields,
                include_fields=include_fields,
            )

        if not resource_db:
            msg = 'Resource with a reference or id "%s" not found' % (ref_or_id)
            raise StackStormDBObjectNotFoundError(msg)

        return resource_db

        Retrieve resource object by an id of a reference.

        Note: This method throws StackStormDBObjectNotFoundError exception if the object is not
        found in the database.
        
st2api/st2api/controllers/resource.py