<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def createPlan(self, plan, thread_id=None):
 """ Sets a plan :param plan: Plan to set :param thread_id: User/Group ID to send plan to. See :ref:`intro_threads` :type plan: models.Plan :raises: FBchatException if request failed """

        thread_id, thread_type = self._getThread(thread_id, None)

        data = {
            "event_type": "EVENT",
            "event_time": plan.time,
            "title": plan.title,
            "thread_id": thread_id,
            "location_id": plan.location_id or "",
            "location_name": plan.location or "",
            "acontext": ACONTEXT,
        }
        j = self._post(self.req_url.PLAN_CREATE, data, fix_request=True, as_json=True)