def _sample_as_dict(self, sample):
if isinstance(sample, dict):<EOL><INDENT>return sample<EOL><DEDENT>if isinstance(sample, (list, numpy.ndarray)):<EOL><INDENT>sample = enumerate(sample)<EOL><DEDENT>return dict(sample)<EOL>
Convert list-like ``sample`` (list/dict/dimod.SampleView),
        ``list: var``, to ``map: idx -> var``.