<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def get_thread(self, thread_id, update_if_cached=True, raise_404=False):
 """Get a thread from 4chan via 4chan API. Args: thread_id (int):
 Thread ID update_if_cached (bool):
 Whether the thread should be updated if it's already in our cache raise_404 (bool):
 Raise an Exception if thread has 404'd Returns: :class:`basc_py4chan.Thread`: Thread object """

        # see if already cached
        cached_thread = self._thread_cache.get(thread_id)
        if cached_thread:
            if update_if_cached:
                cached_thread.update()
            return cached_thread

        res = self._requests_session.get(
            self._url.thread_api_url(
                thread_id = thread_id
                )
        )

        # check if thread exists
        if raise_404:
            res.raise_for_status()
        elif not res.ok:
            return None

        thread = Thread._from_request(self, res, thread_id)
        self._thread_cache[thread_id] = thread

        return thread