code: def has_insufficient_material(self, color: Color) -> bool:
          
          if self.occupied_co[color] & (self.pawns | self.rooks | self.queens):
              return False
  
          # Knights are only insufficient material if:
          # (1) We do not have any other pieces, including more than one knight.
          # (2) The opponent does not have pawns, knights, bishops or rooks.
          #     These would allow self mate.
          if self.occupied_co[color] & self.knights:
              return (popcount(self.occupied_co[color]) <= 2 and
                      not (self.occupied_co[not color] & ~self.kings & ~self.queens))
  
          # Bishops are only insufficient material if:
          # (1) We no dot have any other pieces, including bishops of the
          #     opposite color.
          # (2) The opponent does not have bishops of the opposite color,
          #     pawns or knights. These would allow self mate.
          if self.occupied_co[color] & self.bishops:
              same_color = (not self.bishops & BB_DARK_SQUARES) or (not self.bishops & BB_LIGHT_SQUARES)
              return same_color and not (self.occupied_co[not color] & ~self.kings & ~self.rooks & ~self.queens)
  
          return True
docs: Checks if *color* has insufficient winning material.
  
          This is guaranteed to return ``False`` if *color* can still win the
          game.
  
          The converse does not necessarily hold:
          The implementation only looks at the material, including the colors
          of bishops, but not considering piece positions. So fortress
          positions or positions with forced lines may return ``False``, even
          though there is no possible winning line.