def connect_to_apple_tv(details, loop, session=None): """Connect and logins to an Apple TV.""" # If no session is given, create a default one if session is None: session = ClientSession(loop=loop) # If/when needed, the library should figure out the correct type of Apple # TV and return the correct type for it. airplay = AirPlay(loop, session, details.address) daap_session = DaapSession(session) requester = DaapRequester( daap_session, details.address, details.login_id, details.port) return AppleTVInternal(loop, session, requester, airplay)