<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def ising_to_qubo(h, J, offset=0.0):
 """Convert an Ising problem to a QUBO problem. Map an Ising model defined on spins (variables with {-1, +1} values) to quadratic unconstrained binary optimization (QUBO) formulation :math:`x' Q x` defined over binary variables (0 or 1 values), where the linear term is contained along the diagonal of Q. Return matrix Q that defines the model as well as the offset in energy between the two problem formulations: .. math:: s' J s + h' s = offset + x' Q x See :meth:`~dimod.utilities.qubo_to_ising` for the inverse function. Args: h (dict[variable, bias]):
 the model and values are biases. J (dict[(variable, variable), bias]):
 are 2-tuples of variables of the model and values are quadratic biases associated with the pair of variables (the interaction). offset (numeric, optional, default=0):
 Constant offset to be applied to the energy. Default 0. Returns: (dict, float):
 A 2-tuple containing: dict: QUBO coefficients. float: New energy offset. Examples: This example converts an Ising problem of two variables that have positive biases of value 1 and are positively coupled with an interaction of value 1 to a QUBO problem. ({(1, 1):
 0.0, (1, 2):
 4.0, (2, 2):
 0.0}, -0.5) """

    # the linear biases are the easiest
    q = {(v, v): 2. * bias for v, bias in iteritems(h)}

    # next the quadratic biases
    for (u, v), bias in iteritems(J):
        if bias == 0.0:
            continue
        q[(u, v)] = 4. * bias
        q[(u, u)] -= 2. * bias
        q[(v, v)] -= 2. * bias

    # finally calculate the offset
    offset += sum(itervalues(J)) - sum(itervalues(h))

    return q, offset