def METHOD_NAME(self, name):
    for cs_id, cs_name in self.changesources.items():
        if cs_name == name:
            return defer.succeed(cs_id)
    new_id = (max(self.changesources) + 1) if self.changesources else 1
    self.changesources[new_id] = name
    return defer.succeed(new_id)