# Buggy code
def __init__(self, ip_address):
    # Note: Creation of a SoCo instance should be as cheap and quick as
    # possible. Do not make any network calls here
    super(SoCo, self).__init__()
    # Check if ip_address is a valid IPv4 representation.
    # Sonos does not (yet) support IPv6
    try:
        socket.inet_aton(ip_address)
    except socket.error:
        raise ValueError("Not a valid IP address string")
    #: The speaker's ip address
    self.ip_address = ip_address
    self.speaker_info = {}  # Stores information about the current speaker

    # The services which we use
    # pylint: disable=invalid-name
    self.avTransport = AVTransport(self)
    self.contentDirectory = ContentDirectory(self)
    self.deviceProperties = DeviceProperties(self)
    self.renderingControl = RenderingControl(self)
    self.zoneGroupTopology = ZoneGroupTopology(self)
    self.alarmClock = AlarmClock(self)
    self.systemProperties = SystemProperties(self)
    self.musicServices = MusicServices(self)

    self.music_library = MusicLibrary(self)

    # Some private attributes
    self._all_zones = set()
    self._groups = set()
    self._is_bridge = None
    self._is_coordinator = False
    self._player_name = None
    self._uid = None
    self._household_id = None
    self._visible_zones = set()
    self._zgs_cache = None

    _LOG.debug("Created SoCo instance for ip: %s", ip_address)


# Traceback (soco.exceptions.NotSupportedException)
my_zone
SoCo("192.168.2.253")
my_zone.get_speaker_info()
{u'display_version': '9.1', u'player_icon': '/img/icon-S11.png', u'uid': 'RINCON_XYZ', u'software_version': '45.1-56150', u'mac_address': u'MA-CA-DD-RE-S-S', u'hardware_version': '1.14.1.11-1', u'model_number': 'S11', u'serial_number': 'MA-CA-DD-RE-S-S:1', u'zone_name': 'Family Room', u'model_name': 'Sonos Playbase'}
my_zone.night_mode = True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/soco/core.py", line 813, in night_mode
raise NotSupportedException(message)
soco.exceptions.NotSupportedException: This device does not support night mode
my_zone.dialog_mode = True
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/soco/core.py", line 851, in dialog_mode
raise NotSupportedException(message)
soco.exceptions.NotSupportedException: This device does not support dialog mode

# Fixed code
def __init__(self, ip_address):
    # Note: Creation of a SoCo instance should be as cheap and quick as
    # possible. Do not make any network calls here
    super(SoCo, self).__init__()
    # Check if ip_address is a valid IPv4 representation.
    # Sonos does not (yet) support IPv6
    try:
        socket.inet_aton(ip_address)
    except socket.error:
        raise ValueError("Not a valid IP address string")
    #: The speaker's ip address
    self.ip_address = ip_address
    self.speaker_info = {}  # Stores information about the current speaker

    # The services which we use
    # pylint: disable=invalid-name
    self.avTransport = AVTransport(self)
    self.contentDirectory = ContentDirectory(self)
    self.deviceProperties = DeviceProperties(self)
    self.renderingControl = RenderingControl(self)
    self.zoneGroupTopology = ZoneGroupTopology(self)
    self.alarmClock = AlarmClock(self)
    self.systemProperties = SystemProperties(self)
    self.musicServices = MusicServices(self)

    self.music_library = MusicLibrary(self)

    # Some private attributes
    self._all_zones = set()
    self._groups = set()
    self._is_bridge = None
    self._is_coordinator = False
    self._is_soundbar = None
    self._player_name = None
    self._uid = None
    self._household_id = None
    self._visible_zones = set()
    self._zgs_cache = None

    _LOG.debug("Created SoCo instance for ip: %s", ip_address)