code: def any_soco():
      
  
      cls = config.SOCO_CLASS
      # pylint: disable=no-member, protected-access
      try:
          # Try to get the first pre-existing soco instance we know about,
          # as long as it is visible (i.e. not a bridge etc). Otherwise,
          # perform discovery (again, excluding invisibles) and return one of
          # those
          device = next(d for d in cls._instances[cls._class_group].values()
                        if d.is_visible)
      except (KeyError, StopIteration):
          devices = discover()
          return None if devices is None else devices.pop()
  
      return device
docs: Return any visible soco device, for when it doesn't matter which.
  
      Try to obtain an existing instance, or use `discover` if necessary.
      Note that this assumes that the existing instance has not left
      the network.
  
      Returns:
          SoCo: A `SoCo` instance (or subclass if `config.SOCO_CLASS` is set,
              or `None` if no instances are found