docs: def connect(self, port=None, baud_rate=115200):
          '''
          Parameters
          ----------
          port : str or list-like, optional
              Port (or list of ports) to try to connect to as a DMF Control
              Board.
          baud_rate : int, optional
  
          Returns
          -------
          str
              Port DMF control board was connected on.
  
          Raises
          ------
          RuntimeError
              If connection could not be established.
          IOError
              If no ports were specified and Arduino Mega2560 not found on any
              port.
          '''
          if isinstance(port, types.StringTypes):
              ports = [port]
          else:
              ports = port
  
          if not ports:
              # No port was specified.
              #
              # Try ports matching Mega2560 USB vendor/product ID.
              ports = serial_ports().index.tolist()
              if not ports:
                  raise IOError("Arduino Mega2560 not found on any port.")
  
          for comport_i in ports:
              if self.connected():
                  self.disconnect()
                  self.port = None
                  self._i2c_devices = {}
  
              # Try to connect to control board on available ports.
              try:
                  logger.debug('Try to connect to: %s', comport_i)
                  # Explicitly cast `comport_i` to string since `Base.connect`
                  # Boost Python binding does not support unicode strings.
                  #
                  # Fixes [issue 8][issue-8].
                  #
                  # [issue-8]: https://github.com/wheeler-microfluidics/dmf-control-board-firmware/issues/8
                  Base.connect(self, str(comport_i), baud_rate)
                  self.port = comport_i
                  break
              except BadVGND, exception:
                  logger.warning(exception)
                  break
              except RuntimeError, exception:
                  continue
          else:
              raise RuntimeError('Could not connect to control board on any of '
                                 'the following ports: %s' % ports)
  
          name = self.name()
          version = self.hardware_version()
          firmware = self.software_version()
          serial_number_string = ""
          try:
              serial_number_string = ", S/N %03d" % self.serial_number
          except:
              # Firmware does not support `serial_number` attribute.
              pass
          logger.info("Connected to %s v%s (Firmware: %s%s)" %
                      (name, version, firmware, serial_number_string))
  
          logger.info("Poll control board for series resistors and "
                      "capacitance values.")
  
          self._read_calibration_data()
  
          try:
              self.__aref__ = self._aref()
              logger.info("Analog reference = %.2f V" % self.__aref__)
          except:
              # Firmware does not support `__aref__` attribute.
              pass
  
          # Check VGND for both analog channels
          expected = 2 ** 10/2
          v = {}
          channels = [0, 1]
          damaged = []
          for channel in channels:
              try:
                  v[channel] = np.mean(self.analog_reads(channel, 10))
                  logger.info("A%d VGND = %.2f V (%.2f%% of Aref)", channel,
                              self.__aref__ * v[channel] / (2 ** 10), 100.0 *
                              v[channel] / (2 ** 10))
                  # Make sure that the VGND is close to the expected value;
                  # otherwise, the op-amp may be damaged (expected error
                  # is <= 10%).
                  if np.abs(v[channel] - expected) / expected > .1:
                      damaged.append(channel)
              except:
                  # Firmware does not support `__aref__` attribute.
                  break
  
          # Scan I2C bus to generate list of connected devices.
          self._i2c_scan()
  
          if damaged:
              # At least one of the analog input channels appears to be damaged.
              if len(damaged) == 1:
                  msg = "Analog channel %d appears" % damaged[0]
              else:
                  msg = "Analog channels %s appear" % damaged
              raise BadVGND(msg + " to be damaged. You may need to replace the "
                            "op-amp on the control board.")
  
          return self.RETURN_OK