<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bulkSave(self, docs, onDuplicate="error", **params) : """Parameter docs must be either an iterrable of documents or dictionnaries. This function will return the number of documents, created and updated, and will raise an UpdateError exception if there's at least one error. params are any parameters from arango's documentation"""


        payload = []
        for d in docs :
            if type(d) is dict :
                payload.append(json.dumps(d, default=str))
            else :
                try:
                    payload.append(d.toJson())
                except Exception as e:
                    payload.append(json.dumps(d.getStore(), default=str))

        payload = '\n'.join(payload)

        params["type"] = "documents"
        params["onDuplicate"] = onDuplicate
        params["collection"] = self.name
        URL = "%s/import" % self.database.URL

        r = self.connection.session.post(URL, params = params, data = payload)
        data = r.json()
        if (r.status_code == 201) and "error" not in data :
            return True
        else :
            if data["errors"] > 0 :
                raise UpdateError("%d documents could not be created" % data["errors"], data)

        return data["updated"] + data["created"]