'Add a tag to a room for a user.
Args:
user_id(str): The user to add a tag for.
room_id(str): The room to add a tag for.
tag(str): The tag name to add.
content(dict): A json object to associate with the tag.
Returns:
A deferred that completes once the tag has been added.'

@defer.inlineCallbacks
def add_tag_to_room(self, user_id, room_id, tag, content):

    content_json = json.dumps(content)
    def add_tag_txn(txn, next_id):
        self._simple_upsert_txn(txn, table='room_tags', keyvalues={'user_id': user_id, 'room_id': room_id, 'tag': tag}, values={'content': content_json})
        self._update_revision_txn(txn, user_id, room_id, next_id)
    with self._account_data_id_gen.get_next() as next_id:
        (yield self.runInteraction('add_tag', add_tag_txn, next_id))
    self.get_tags_for_user.invalidate((user_id,))
    result = self._account_data_id_gen.get_current_token()
    defer.returnValue(result)
