code: def _parse_mode(self, config):
          
          value = re.search(r'switchport mode (\w+)', config, re.M)
          return dict(mode=value.group(1))
docs: Scans the specified config and parses the switchport mode value
  
          Args:
              config (str): The interface configuration block to scan
  
          Returns:
              dict: A Python dict object with the value of switchport mode.
                  The dict returned is intended to be merged into the resource
                  dict