def _get_primitive_by_name(self, name):
        primitives = self.api._model_query(
            'primitives',
            'name="%s"' % name)

        if len(primitives) > 0:
            return primitives[0]

        # walk through the self.task_primitives
        primitives = [self.task_primitives[x] for x in
                      self.task_primitives if
                      self.task_primitives[x]['name'] == name]
        if len(primitives) > 0:
            return primitives[0]

        return None
dataset/ETHPy150Open rcbops/opencenter/opencenter/webapp/solver.py/Solver._get_primitive_by_name/original