<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def set_clipboard(self, data, datatype="text"):
 """Writes data to the clipboard Parameters data: Object \tData object for clipboard datatype: String in ["text", "bitmap"] \tIdentifies datatype to be copied to the clipboard """


        error_log = []

        if datatype == "text":
            clip_data = wx.TextDataObject(text=data)

        elif datatype == "bitmap":
            clip_data = wx.BitmapDataObject(bitmap=data)

        else:
            msg = _("Datatype {type} unknown").format(type=datatype)
            raise ValueError(msg)

        if self.clipboard.Open():
            self.clipboard.SetData(clip_data)
            self.clipboard.Close()
        else:
            wx.MessageBox(_("Can't open the clipboard"), _("Error"))

        return error_log