code: def discover(self, directory=None):
          
          directory = directory or self.patches_dir
          patches = []
          for root, dirs, files in os.walk(directory):
              for f in files:
                  if not f.endswith('.py'):
                      continue
                  name = f.rsplit('.', 1)[0]
                  module = imp.load_source(name, '%s/%s' % (root, f))
                  for elem in dir(module):
                      elem = getattr(module, elem)
                      if isinstance(elem, Patch):
                          patches.append(elem)
  
          def patch_key(patch):
              return tuple(int(i) for i in patch.target_version.split('.'))
  
          return sorted(patches, key=patch_key)
docs: Recusively search & collect :class:`Patch`
  
          :param directory: Directory to search in (default: patches_dir)