def role(self, name):
        if name not in self.roles:
            try:
                role = Role.objects.get(name=name)
                created = False
            except DoesNotExist:
                # noinspection PyArgumentList
                role = Role(name=name,
                            description='role created by population')
                role.save()
                created = True
            self.roles[name] = role
            if created:
                logger.info("Created role: %s", name)
        return self.roles.get(name)
dataset/ETHPy150Open LeightonStreet/LingoBarter/lingobarter/utils/populate.py/Populate.role/original