code: def metaclasses(bases):
      ''' Returns 'proper' metaclasses for the classes in bases
      '''
      ret = []
      metas = [type(base) for base in bases]
      for k,meta in enumerate(metas):
          if not any(issubclass(m, meta) for m in metas[k+1:]):
              ret.append(meta)
  
      if type in ret:
          ret.remove(type)
      return ref metaclasses(bases):
      ''' Returns 'proper' metaclasses for the classes in bases
      '''
      ret = []
      metas = [type(base) for base in bases]
      for k,meta in enumerate(metas):
          if not any(issubclass(m, meta) for m in metas[k+1:]):
              ret.append(meta)
  
      if type in ret:
          ret.remove(type)
      return ret
docs: Returns 'proper' metaclasses for the classes in bases