<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def unembed_sampleset(target_sampleset, embedding, source_bqm, chain_break_method=None, chain_break_fraction=False):
 """Unembed the samples set. Construct a sample set for the source binary quadratic model (BQM) by unembedding the given samples from the target BQM. Args: target_sampleset (:obj:`dimod.SampleSet`):
 SampleSet from the target BQM. embedding (dict):
 Mapping from source graph to target graph as a dict of form variable. source_bqm (:obj:`dimod.BinaryQuadraticModel`):
 Source binary quadratic model. chain_break_method (function, optional):
 Method used to resolve chain breaks. See :mod:`dwave.embedding.chain_breaks`. chain_break_fraction (bool, optional, default=False):
 If True, a 'chain_break_fraction' field is added to the unembedded samples which report what fraction of the chains were broken before unembedding. Returns: :obj:`.SampleSet`: Examples: {0: -1, 1: +1, 2: +1, 3: +1}] # [0, 1] is broken array([[-1, -1, -1], [ 1, 1, 1]], dtype=int8) """


    if chain_break_method is None:
        chain_break_method = majority_vote

    variables = list(source_bqm)
    try:
        chains = [embedding[v] for v in variables]
    except KeyError:
        raise ValueError("given bqm does not match the embedding")

    chain_idxs = [[target_sampleset.variables.index[v] for v in chain] for chain in chains]

    record = target_sampleset.record

    unembedded, idxs = chain_break_method(record.sample, chain_idxs)

    # dev note: this is a bug in dimod that empty unembedded is not handled,
    # in the future this try-except can be removed
    try:
        energies = source_bqm.energies((unembedded, variables))
    except ValueError:
        datatypes = [('sample', np.dtype(np.int8), (len(variables),)), ('energy', np.float)]
        datatypes.extend((name, record[name].dtype, record[name].shape[1:])
                         for name in record.dtype.names
                         if name not in {'sample', 'energy'})
        if chain_break_fraction:
            datatypes.append(('chain_break_fraction', np.float64))
        # there are no samples so everything is empty
        data = np.rec.array(np.empty(0, dtype=datatypes))
        return dimod.SampleSet(data, variables, target_sampleset.info.copy(), target_sampleset.vartype)

    reserved = {'sample', 'energy'}
    vectors = {name: record[name][idxs]
               for name in record.dtype.names if name not in reserved}

    if chain_break_fraction:
        vectors['chain_break_fraction'] = broken_chains(record.sample, chain_idxs).mean(axis=1)[idxs]

    return dimod.SampleSet.from_samples((unembedded, variables),
                                        target_sampleset.vartype,
                                        energy=energies,
                                        info=target_sampleset.info.copy(),
                                        **vectors)