Get a qubit from an object.

    :param qubit: An int or Qubit.
    :return: A Qubit instance

def unpack_qubit(qubit):
    """
    Get a qubit from an object.

    :param qubit: An int or Qubit.
    :return: A Qubit instance
    """
    if isinstance(qubit, integer_types):
        return Qubit(qubit)
    elif isinstance(qubit, Qubit):
        return qubit
    elif isinstance(qubit, QubitPlaceholder):
        return qubit
    else:
        raise TypeError("qubit should be an int or Qubit instance")