<s>[INST] This problem requires the use of an iterative method to find the roots of a given polynomial. The iterative method to be used is the bisection method.

The problem states that we need to find the roots of the polynomial x^3-5x^2+17x-13. We can use the bisection method to find the approximate value of the roots.

To apply the bisection method, we need to have an initial guess for the root, and an interval in which the root lies. Then, we can use the bisection method formula to iteratively find a more accurate value of the root.

However, instead of writing the code in C, I want you to write an equivalent code in Python, and I will translate it to C later. 

Here is the bisection method formula: 

f(x) = x^n + a1*x^(n-1) + a2*x^(n-2) + ... + an

BIS(x1, x2) = (x1*f(x2)-x2*f(x1))/(f(x2)-f(x1))

Here is an algorithm that can be followed: 

1. Start with an initial guess for the root and an interval [x1, x2] in which the root lies. 

2. Calculate f(x1) and f(x2). If f(x1)*f(x2)>0, then swap x1 and x2. 

3. If abs(f(x1))< tolerance, return x1. 

4. Calculate BIS(x1, x2) using the formula above. 

5. If f(x1)*f(BIS(x1, x2))<0, replace x2 with BIS(x1, x2), otherwise replace x1 with BIS(x1, x2). 

6. Repeat steps 3 to 5 until abs(f(x1))<tolerance or the maximum number of iterations is reached. 

7. Return x1. 

The polynomial to be used is x^3-5x^2+17x-13. 

Please use the following initial guesses and intervals: 
1. x1 = 0.5, x2 = 2.0 
2. x1 = 1.5, x2 = 3.0 

Here is the polynomial function: 

poly(x,a,b,c) = a*x^3+b*x^2+c*x+d
poly(x, 1,-5,17,-13)
So, we will pass the coefficients a,b,c,d to the function poly. 

Please apply the tolerance = 0.0001 and max iterations = 100. 

Here is the Python code to calculate f(x) = a*x^3 + b*x^2 + c*x + d:
```python
def poly(x,a,b,c,d):
    return a*x**3+b*x**2+c*x+d
```
Based on the steps and the algorithm above, I would like you to write the Python code for the bisection method. 

Please use a for loop and an if-else statement in your code. 

Also, should we swap x1 and x2 if f(x1)*f(x2)>0?[/INST]