async def pair(self):
<EOL>protocol = self.atv.service.protocol<EOL>if protocol == const.PROTOCOL_DMAP:<EOL><INDENT>await self.atv.pairing.start(zeroconf=Zeroconf(),<EOL>name=self.args.remote_name,<EOL>pairing_guid=self.args.pairing_guid)<EOL><DEDENT>elif protocol == const.PROTOCOL_MRP:<EOL><INDENT>await self.atv.pairing.start()<EOL><DEDENT>if self.atv.pairing.device_provides_pin:<EOL><INDENT>pin = await _read_input(self.loop, '<STR_LIT>')<EOL>self.atv.pairing.pin(pin)<EOL><DEDENT>else:<EOL><INDENT>self.atv.pairing.pin(self.args.pin_code)<EOL>print('<STR_LIT>'.format(<EOL>self.args.pin_code, self.args.remote_name))<EOL><DEDENT>if self.args.pin_code is None:<EOL><INDENT>print('<STR_LIT>'.format(<EOL>self.args.remote_name))<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>'.format(<EOL>self.args.pin_code, self.args.remote_name))<EOL><DEDENT>await self.loop.run_in_executor(None, sys.stdin.readline)<EOL>await self.atv.pairing.stop()<EOL>if self.atv.pairing.has_paired:<EOL><INDENT>print('<STR_LIT>')<EOL>print('<STR_LIT>'.format(<EOL>self.atv.pairing.credentials))<EOL><DEDENT>else:<EOL><INDENT>print('<STR_LIT>')<EOL>return <NUM_LIT:1><EOL><DEDENT>return <NUM_LIT:0><EOL>
Pair pyatv as a remote control with an Apple TV.