Returns a set of attacked/defended squares

def controls(self, move):
    '''Returns a set of attacked/defended squares'''
    to_move = self.board.turn
    analysis_board = chess.Board(self.board.fen())
    analysis_board.push(move)
    squares = 0
    for square in chess.SQUARES:
      if move.to_square in analysis_board.attackers(to_move, square):
        squares |= chess.BB_SQUARES[square]
    return SquareSet(squares)