class SearchList(list):

    def find(self, name):
        items = []
        for child in self:
            if child.__class__ == self.__class__:
                items += child.find(name)
            else:
                if child == name:
                    items.append(child)

        if len(items) == 1:
            return items[0]
        elif items != []:
            return items


class SearchList(list):

    def find(self, name):
        items = []
        for child in self:
            if child.__class__ == self.__class__:
                items += child.find(name)
            else:
                if child == name:
                    items.append(child)

        if len(items) == 1:
            return items[0]
        elif items:
            return items
        else:
            return None

Simplify expression, add explicit return value
Simplify expression, add explicit return value

  class SearchList(list):
  
      def find(self, name):
          items = []
          for child in self:
              if child.__class__ == self.__class__:
                  items += child.find(name)
              else:
                  if child == name:
                      items.append(child)
  
          if len(items) == 1:
              return items[0]
-         elif items != []:
+         elif items:
              return items
+         else:
+             return None
  
- 
Simplify expression, add explicit return value
## Code Before:
class SearchList(list):

    def find(self, name):
        items = []
        for child in self:
            if child.__class__ == self.__class__:
                items += child.find(name)
            else:
                if child == name:
                    items.append(child)

        if len(items) == 1:
            return items[0]
        elif items != []:
            return items


## Instruction:
Simplify expression, add explicit return value
## Code After:
class SearchList(list):

    def find(self, name):
        items = []
        for child in self:
            if child.__class__ == self.__class__:
                items += child.find(name)
            else:
                if child == name:
                    items.append(child)

        if len(items) == 1:
            return items[0]
        elif items:
            return items
        else:
            return None
