def send_request(self, endpoint: str, data: Dict[str, Any], files: Dict[str, Any] = None, method: str = "POST", return_raw: bool = False) -> Any:
        """
        General method to send an API request.

        Args:
            endpoint: The API endpoint to send the request to.
            data: The data to send in the request.
            files: Optional files to upload.
            method: HTTP method to use (GET or POST)
            return_raw: Whether to return the raw response content instead of JSON

        Returns:
            The response from the API, either as JSON or raw content.
        """
        try:
            # Try to get the current event loop
            try:
                loop = asyncio.get_running_loop()
                if loop.is_running():
                    # We're in an async context, but this is a sync method
                    # We need to run the async method in a new thread
                    return run_coroutine_in_new_thread(
                        self.send_request_async(endpoint, data, files, method, return_raw)
                    )
            except RuntimeError:
                # No event loop is running, use asyncio.run
                return asyncio.run(self.send_request_async(endpoint, data, files, method, return_raw))
        except httpx.RequestError as e:
            raise e

        General method to send an API request.

        Args:
            endpoint: The API endpoint to send the request to.
            data: The data to send in the request.
            files: Optional files to upload.
            method: HTTP method to use (GET or POST)
            return_raw: Whether to return the raw response content instead of JSON

        Returns:
            The response from the API, either as JSON or raw content.
        
src/upsonic/client/base.py