def get_counts(self, experiment=None):
try:<EOL><INDENT>exp = self._get_experiment(experiment)<EOL>try:<EOL><INDENT>header = exp.header.to_dict()<EOL><DEDENT>except (AttributeError, QiskitError):  <EOL><INDENT>header = None<EOL><DEDENT>return postprocess.format_counts(self.data(experiment)['<STR_LIT>'],<EOL>header)<EOL><DEDENT>except KeyError:<EOL><INDENT>raise QiskitError('<STR_LIT>'.format(experiment))<EOL><DEDENT>
Get the histogram data of an experiment.

        Args:
            experiment (str or QuantumCircuit or Schedule or int or None): the index of the
                experiment, as specified by ``get_data()``.

        Returns:
            dict[str:int]: a dictionary with the counts for each qubit, with
                the keys containing a string in binary format and separated
                according to the registers in circuit (e.g. ``0100 1110``).
                The string is little-endian (cr[0] on the right hand side).

        Raises:
            QiskitError: if there are no counts for the experiment.