I am trying to run fsolve on the following function:

```
   func = lambda D1: float(PH_qp1-phase(csqrt(omega*1j/D1)* \
  special.kv(1,csqrt(omega*1j/D1)*ri)/special.kv(0,csqrt(omega*1j/D1)*ri)) \
    /2/pi)

```

When I run the function itself, it returns a real number, but if I try to run `fsolve`:

```
D_init = 0.1
D_sol = fsolve(func, D_init)

```

it gives me the error

```
TypeError: can't convert complex to float

```