def from_dict(self, input_dict):
<EOL>if len(input_dict) >= <NUM_LIT:1>:<EOL><INDENT>key = list(input_dict.keys())[<NUM_LIT:0>]<EOL>value = input_dict[key]<EOL>if (isinstance(key, tuple) and  <EOL>len(key) == <NUM_LIT:2> and<EOL>isinstance(key[<NUM_LIT:0>], str) and<EOL>isinstance(key[<NUM_LIT:1>], int) and<EOL>isinstance(value, tuple) and<EOL>len(value) == <NUM_LIT:2> and<EOL>isinstance(key[<NUM_LIT:0>], str) and<EOL>isinstance(key[<NUM_LIT:1>], int)):<EOL><INDENT>warnings.warn("<STR_LIT>"<EOL>"<STR_LIT>" % (key + value),<EOL>DeprecationWarning)<EOL>qreg_names = {qubit[<NUM_LIT:0>] for qubit in input_dict.keys()}<EOL>qregs = {}<EOL>for qreg_name in qreg_names:<EOL><INDENT>qregs[qreg_name] = QuantumRegister(<EOL>max([qubit[<NUM_LIT:1>] for qubit in input_dict.keys() if qubit[<NUM_LIT:0>] == qreg_name]) + <NUM_LIT:1>,<EOL>qreg_name)<EOL><DEDENT>new_input_dict = {}<EOL>for key, value in input_dict.items():<EOL><INDENT>new_input_dict[value[<NUM_LIT:1>]] = (qregs[key[<NUM_LIT:0>]], key[<NUM_LIT:1>])<EOL><DEDENT>input_dict = new_input_dict<EOL><DEDENT><DEDENT>for key, value in input_dict.items():<EOL><INDENT>virtual, physical = Layout.order_based_on_type(key, value)<EOL>self._p2v[physical] = virtual<EOL>if virtual is None:<EOL><INDENT>continue<EOL><DEDENT>self._v2p[virtual] = physical<EOL><DEDENT>
Populates a Layout from a dictionary.
The dictionary must be a bijective mapping between
virtual qubits (tuple) and physical qubits (int).

Args:
    input_dict (dict):
        e.g.:
        {(QuantumRegister(3, 'qr'), 0): 0,
         (QuantumRegister(3, 'qr'), 1): 1,
         (QuantumRegister(3, 'qr'), 2): 2}

        Can be written more concisely as follows:

        virtual to physical:
            {qr[0]: 0,
             qr[1]: 1,
             qr[2]: 2}

        physical to virtual:
            {0: qr[0],
             1: qr[1],
             2: qr[2]}