def channel_unbalancedness_and_commit_fee(local_balance, capacity,
    commit_fee, initiator):
    """
    Calculates the unbalancedness.

    :param local_balance: int
    :param capacity: int
    :param commit_fee: int
    :param initiator: bool
    :return: float:
        in [-1.0, 1.0]
    """
    commit_fee = 0 if not initiator else commit_fee
    return -(2 * float(local_balance + commit_fee) / capacity - 1), commit_fee
