def setup_platform(hass, config, add_devices_callback, discovery_info=None):
    config = config_from_file(hass.config.path(PLEX_CONFIG_FILE))
    if len(config):
        # Setup a configured PlexServer
        host, token = config.popitem()
        token = token['token']
    # Via discovery
    elif discovery_info is not None:
        # Parse discovery data
        host = urlparse(discovery_info[1]).netloc
        _LOGGER.info('Discovered PLEX server: %s', host)

        if host in _CONFIGURING:
            return
        token = None
    else:
        return

    setup_plexserver(host, token, hass, add_devices_callback)


# pylint: disable=too-many-branches
Setup the Plex platform.
dataset/ETHPy150Open home-assistant/home-assistant/homeassistant/components/media_player/plex.py/setup_platform