code: def get_pin(self, pin_def):
          
          if type(pin_def) == list:
              bits = pin_def
          else:
              bits = pin_def.split(':')
          a_d = bits[0] == 'a' and 'analog' or 'digital'
          part = getattr(self, a_d)
          pin_nr = int(bits[1])
          if pin_nr >= len(part):
              raise InvalidPinDefError('Invalid pin definition: {0} at position 3 on {1}'
                                       .format(pin_def, self.name))
          if getattr(part[pin_nr], 'mode', None) == UNAVAILABLE:
              raise InvalidPinDefError('Invalid pin definition: '
                                       'UNAVAILABLE pin {0} at position on {1}'
                                       .format(pin_def, self.name))
          if self.taken[a_d][pin_nr]:
              raise PinAlreadyTakenError('{0} pin {1} is already taken on {2}'
                                         .format(a_d, bits[1], self.name))
          # ok, should be available
          pin = part[pin_nr]
          self.taken[a_d][pin_nr] = True
          if pin.type is DIGITAL:
              if bits[2] == 'p':
                  pin.mode = PWM
              elif bits[2] == 's':
                  pin.mode = SERVO
              elif bits[2] != 'o':
                  pin.mode = INPUT
          else:
              pin.enable_reporting()
          return pin
docs: Returns the activated pin given by the pin definition.
          May raise an ``InvalidPinDefError`` or a ``PinAlreadyTakenError``.
  
          :arg pin_def: Pin definition as described below,
              but without the arduino name. So for example ``a:1:i``.
  
          'a' analog pin     Pin number   'i' for input
          'd' digital pin    Pin number   'o' for output
                                          'p' for pwm (Pulse-width modulation)
  
          All seperated by ``:``.