Perform MIB variable ID conversion.

        Parameters
        ----------
        mibViewController : :py:class:`~pysnmp.smi.view.MibViewController`
            class instance representing MIB browsing functionality.

        Returns
        -------
        : :py:class:`~pysnmp.smi.rfc1902.ObjectIdentity`
            reference to itself

        Raises
        ------
        SmiError
           In case of fatal MIB hanling errora

        Notes
        -----
        Calling this method might cause the following sequence of
        events (exact details depends on many factors):

        * ASN.1 MIB file downloaded and handed over to
          :py:class:`~pysmi.compiler.MibCompiler` for conversion into
          Python MIB module (based on pysnmp classes)
        * Python MIB module is imported by SNMP engine, internal indices
          created
        * :py:class:`~pysnmp.smi.view.MibViewController` looks up the
          rest of MIB identification information based on whatever information
          is already available, :py:class:`~pysnmp.smi.rfc1902.ObjectIdentity`
          class instance
          gets updated and ready for further use.

        Examples
        --------
        >>> objectIdentity = ObjectIdentity('SNMPv2-MIB', 'sysDescr')
        >>> objectIdentity.resolveWithMib(mibViewController)
        ObjectIdentity('SNMPv2-MIB', 'sysDescr')
        >>>

def resolveWithMib(self, mibViewController):
        """Perform MIB variable ID conversion.

        Parameters
        ----------
        mibViewController : :py:class:`~pysnmp.smi.view.MibViewController`
            class instance representing MIB browsing functionality.

        Returns
        -------
        : :py:class:`~pysnmp.smi.rfc1902.ObjectIdentity`
            reference to itself

        Raises
        ------
        SmiError
           In case of fatal MIB hanling errora

        Notes
        -----
        Calling this method might cause the following sequence of
        events (exact details depends on many factors):

        * ASN.1 MIB file downloaded and handed over to
          :py:class:`~pysmi.compiler.MibCompiler` for conversion into
          Python MIB module (based on pysnmp classes)
        * Python MIB module is imported by SNMP engine, internal indices
          created
        * :py:class:`~pysnmp.smi.view.MibViewController` looks up the
          rest of MIB identification information based on whatever information
          is already available, :py:class:`~pysnmp.smi.rfc1902.ObjectIdentity`
          class instance
          gets updated and ready for further use.

        Examples
        --------
        >>> objectIdentity = ObjectIdentity('SNMPv2-MIB', 'sysDescr')
        >>> objectIdentity.resolveWithMib(mibViewController)
        ObjectIdentity('SNMPv2-MIB', 'sysDescr')
        >>>
        """
        if self._mibSourcesToAdd is not None:
            debug.logger & debug.FLAG_MIB and debug.logger(
                'adding MIB sources %s' % ', '.join(self._mibSourcesToAdd))

            mibViewController.mibBuilder.addMibSources(
                *[ZipMibSource(x) for x in self._mibSourcesToAdd])

            self._mibSourcesToAdd = None

        if self._asn1SourcesToAdd is None:
            addMibCompiler(
                mibViewController.mibBuilder,
                ifAvailable=True, ifNotAdded=True)

        else:
            debug.logger & debug.FLAG_MIB and debug.logger(
                'adding MIB compiler with source paths '
                '%s' % ', '.join(self._asn1SourcesToAdd))

            addMibCompiler(
                mibViewController.mibBuilder,
                sources=self._asn1SourcesToAdd,
                searchers=self._asn1SourcesOptions.get('searchers'),
                borrowers=self._asn1SourcesOptions.get('borrowers'),
                destination=self._asn1SourcesOptions.get('destination'),
                ifAvailable=self._asn1SourcesOptions.get('ifAvailable'),
                ifNotAdded=self._asn1SourcesOptions.get('ifNotAdded')
            )

            self._asn1SourcesToAdd = self._asn1SourcesOptions = None

        if self._modNamesToLoad is not None:
            debug.logger & debug.FLAG_MIB and debug.logger(
                'loading MIB modules %s' % ', '.join(self._modNamesToLoad))

            mibViewController.mibBuilder.loadModules(*self._modNamesToLoad)

            self._modNamesToLoad = None

        if self._state & self.ST_CLEAN:
            return self

        MibScalar, MibTableColumn = mibViewController.mibBuilder.importSymbols(
            'SNMPv2-SMI', 'MibScalar', 'MibTableColumn')

        self._indices = ()

        if isinstance(self._args[0], ObjectIdentity):
            self._args[0].resolveWithMib(mibViewController)

        if len(self._args) == 1:  # OID or label or MIB module
            debug.logger & debug.FLAG_MIB and debug.logger(
                'resolving %s as OID or label' % self._args)

            try:
                # pyasn1 ObjectIdentifier or sequence of ints or string OID
                self._oid = rfc1902.ObjectName(self._args[0])  # OID

            except PyAsn1Error:
                # sequence of sub-OIDs and labels
                if isinstance(self._args[0], (list, tuple)):
                    prefix, label, suffix = mibViewController.getNodeName(
                        self._args[0])

                # string label
                elif '.' in self._args[0]:
                    prefix, label, suffix = mibViewController.getNodeNameByOid(
                        tuple(self._args[0].split('.')))

                # MIB module name
                else:
                    modName = self._args[0]

                    mibViewController.mibBuilder.loadModules(modName)

                    if self._kwargs.get('last'):
                        (prefix, label,
                         suffix) = mibViewController.getLastNodeName(modName)

                    else:
                        (prefix, label,
                         suffix) = mibViewController.getFirstNodeName(modName)

                if suffix:
                    try:
                        suffix = tuple(int(x) for x in suffix)

                    except ValueError:
                        raise SmiError(
                            'Unknown object name component %r' % (suffix,))

                self._oid = rfc1902.ObjectName(prefix + suffix)

            else:
                prefix, label, suffix = mibViewController.getNodeNameByOid(
                    self._oid)

            debug.logger & debug.FLAG_MIB and debug.logger(
                'resolved %r into prefix %r and suffix '
                '%r' % (self._args, prefix, suffix))

            modName, symName, _ = mibViewController.getNodeLocation(prefix)

            self._modName = modName
            self._symName = symName

            self._label = label

            mibNode, = mibViewController.mibBuilder.importSymbols(
                modName, symName)

            self._mibNode = mibNode

            debug.logger & debug.FLAG_MIB and debug.logger(
                'resolved prefix %r into MIB node %r' % (prefix, mibNode))

            if isinstance(mibNode, MibTableColumn):  # table column
                if suffix:
                    rowModName, rowSymName, _ = mibViewController.getNodeLocation(
                        mibNode.name[:-1]
                    )

                    rowNode, = mibViewController.mibBuilder.importSymbols(
                        rowModName, rowSymName
                    )

                    self._indices = rowNode.getIndicesFromInstId(suffix)

            elif isinstance(mibNode, MibScalar):  # scalar
                if suffix:
                    self._indices = (rfc1902.ObjectName(suffix),)

            else:
                if suffix:
                    self._indices = (rfc1902.ObjectName(suffix),)

            self._state |= self.ST_CLEAN

            debug.logger & debug.FLAG_MIB and debug.logger(
                'resolved indices are %r' % (self._indices,))

            return self

        elif len(self._args) > 1:  # MIB, symbol[, index, index ...]
            # MIB, symbol, index, index
            if self._args[0] and self._args[1]:
                self._modName = self._args[0]
                self._symName = self._args[1]

            # MIB, ''
            elif self._args[0]:
                mibViewController.mibBuilder.loadModules(self._args[0])

                if self._kwargs.get('last'):
                    (prefix, label,
                     suffix) = mibViewController.getLastNodeName(self._args[0])

                else:
                    (prefix, label,
                     suffix) = mibViewController.getFirstNodeName(self._args[0])

                (self._modName,
                 self._symName, _) = mibViewController.getNodeLocation(prefix)

            # '', symbol, index, index
            else:
                (prefix, label,
                 suffix) = mibViewController.getNodeName(self._args[1:])

                (self._modName,
                 self._symName, _) = mibViewController.getNodeLocation(prefix)

            mibNode, = mibViewController.mibBuilder.importSymbols(
                self._modName, self._symName)

            self._mibNode = mibNode

            self._oid = rfc1902.ObjectName(mibNode.getName())

            (prefix, label,
             suffix) = mibViewController.getNodeNameByOid(
                self._oid)

            self._label = label

            debug.logger & debug.FLAG_MIB and debug.logger(
                'resolved %r into prefix %r and suffix '
                '%r' % (self._args, prefix, suffix))

            if isinstance(mibNode, MibTableColumn):  # table
                rowModName, rowSymName, _ = mibViewController.getNodeLocation(
                    mibNode.name[:-1])

                rowNode, = mibViewController.mibBuilder.importSymbols(
                    rowModName, rowSymName)

                if self._args[2:]:
                    try:
                        instIds = rowNode.getInstIdFromIndices(*self._args[2:])
                        self._oid += instIds
                        self._indices = rowNode.getIndicesFromInstId(instIds)

                    except PyAsn1Error as exc:
                        raise SmiError(
                            'Instance index %r to OID conversion failure '
                            'at object %r: '
                            '%s' % (self._args[2:], mibNode.getLabel(), exc))

            elif self._args[2:]:  # any other kind of MIB node with indices
                if self._args[2:]:
                    instId = rfc1902.ObjectName(
                        '.'.join(str(x) for x in self._args[2:]))

                    self._oid += instId

                    self._indices = (instId,)

            self._state |= self.ST_CLEAN

            debug.logger & debug.FLAG_MIB and debug.logger(
                'resolved indices are %r' % (self._indices,))

            return self

        else:
            raise SmiError('Non-OID, label or MIB symbol')