async def METHOD_NAME(loop):
    atvs = await pyatv.scan(loop, timeout=timeout)
    # Take the first device found
    if atvs:
        atv = await pyatv.connect(atvs[0], loop)
        try:
            await handler(atv)
        finally:
            atv.close()
    else:
        if not_found is not None:
            await not_found()