<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def bg_phase_mask_for_qpi(qpi, r0, method="edge", model="projection", edgekw={}, imagekw={}, radial_clearance=1.1):
 """Determine the background phase mask for a spherical phase object The position and radius of the phase object are determined with :func:`analyze`, to which the corresponding keyword arguments are passed. A binary mask is created from the simulation results via :func:`bg_phase_mask_from_sim`. Parameters qpi: qpimage.QPImage Quantitative phase image data r0: float Approximate radius of the sphere [m] method: str The method used to determine the refractive index can either be "edge" (determine the radius from the edge detected in the phase image) or "image" (perform a 2D phase image fit). model: str The light-scattering model used by `method`. If `method` is "edge", only "projection" is allowed. If `method` is "image", `model` can be one of "mie", "projection", "rytov", or "rytov-sc". edgekw: dict Keyword arguments for tuning the edge detection algorithm, see :func:`qpsphere.edgefit.contour_canny`. imagekw: dict Keyword arguments for tuning the image fitting algorithm, see :func:`qpsphere.imagefit.alg.match_phase` radial_clearance: float Multiplicator to the fitted radius of the sphere; modifies the size of the mask; set to "1" to use the radius determined by :func:`qpsphere.analyze`. The circular area containing the phase object is set to `False` in the output `mask` image. Returns ------- mask: boolean 2d np.ndarray The mask is `True` for background regions and `False` for object regions. """

    # fit sphere
    _, _, sim = analyze(qpi=qpi,
                        r0=r0,
                        method=method,
                        model=model,
                        edgekw=edgekw,
                        imagekw=imagekw,
                        ret_qpi=True)
    # determine mask
    mask = bg_phase_mask_from_sim(sim=sim,
                                  radial_clearance=radial_clearance)
    return mask