<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 async def auth(self):
 """Perform AirPlay device authentication."""

        credentials = await self.atv.airplay.generate_credentials()
        await self.atv.airplay.load_credentials(credentials)

        try:
            await self.atv.airplay.start_authentication()
            pin = await _read_input(self.loop, 'Enter PIN on screen: ')

            await self.atv.airplay.finish_authentication(pin)
            print('You may now use these credentials:')
            print(credentials)
            return 0

        except exceptions.DeviceAuthenticationError:
            logging.exception('Failed to authenticate - invalid PIN?')
            return 1