<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def register(self, intent):
 """Registers a new intent and returns the Intent object with an ID"""

        response = self.api.post_intent(intent.serialize)
        print(response)
        print()
        if response['status']['code'] == 200:
            intent.id = response['id']
        elif response['status']['code'] == 409: # intent already exists
            intent.id = next(i.id for i in self.api.agent_intents if i.name == intent.name)
            self.update(intent)
        return intent