def pretty(self, indent=0):
        """Returns a string with a formatted representation that might
        be considered pretty-printable."""
        indent = indent * ' '
        lines = list()
        version_string = "{v.major}.{v.minor}".format(v=self.version)
        lines.append(("handover version", version_string))
        if self.error.reason:
            lines.append(("error reason", self.error.reason))
            lines.append(("error value", self.error.value))
        for index, carrier in enumerate(self.carriers):
            lines.append(("carrier {0}:".format(index+1),))
            lines.append((indent + "power state", carrier.power_state))
            if carrier.record.type == "urn:nfc:wkt:Hc":
                carrier_type = carrier.record.carrier_type
                carrier_data = carrier.record.carrier_data
                lines.append((indent + "carrier type", carrier_type))
                lines.append((indent + "carrier data", repr(carrier_data)))
            else:
                if carrier.type == "application/vnd.bluetooth.ep.oob":
                    carrier_record = BluetoothConfigRecord(carrier.record)
                elif carrier.type == "application/vnd.wfa.wsc":
                    carrier_record = WifiConfigRecord(carrier.record)
                else:
                    carrier_record = carrier.record
                lines.append((indent + "carrier type", carrier.type))
                pretty_lines = carrier_record.pretty(2).split('\n')
                lines.extend([tuple(l.split(' = ')) for l in pretty_lines
                              if not l.strip().startswith("identifier")])
            for record in carrier.auxiliary_data_records:
                lines.append((indent + "auxiliary data",))
                lines.append((2*indent + "record type", record.type))
                lines.append((2*indent + "record data", repr(record.data)))

        lwidth = max([len(line[0]) for line in lines])
        lines = [(line[0].ljust(lwidth),) + line[1:] for line in lines]
        lines = [" = ".join(line) for line in lines]
        return ("\n").join([indent + line for line in lines])
def pretty ( self , indent = 0 ) : indent = indent * ' ' lines = list ( ) version_string = "{v.major}.{v.minor}" . format ( v = self . version ) lines . append ( ( "handover version" , version_string ) ) if self . error . reason : lines . append ( ( "error reason" , self . error . reason ) ) lines . append ( ( "error value" , self . error . value ) ) for index , carrier in enumerate ( self . carriers ) : lines . append ( ( "carrier {0}:" . format ( index + 1 ) , ) ) lines . append ( ( indent + "power state" , carrier . power_state ) ) if carrier . record . type == "urn:nfc:wkt:Hc" : carrier_type = carrier . record . carrier_type carrier_data = carrier . record . carrier_data lines . append ( ( indent + "carrier type" , carrier_type ) ) lines . append ( ( indent + "carrier data" , repr ( carrier_data ) ) ) else : if carrier . type == "application/vnd.bluetooth.ep.oob" : carrier_record = BluetoothConfigRecord ( carrier . record ) elif carrier . type == "application/vnd.wfa.wsc" : carrier_record = WifiConfigRecord ( carrier . record ) else : carrier_record = carrier . record lines . append ( ( indent + "carrier type" , carrier . type ) ) pretty_lines = carrier_record . pretty ( 2 ) . split ( '\n' ) lines . extend ( [ tuple ( l . split ( ' = ' ) ) for l in pretty_lines if not l . strip ( ) . startswith ( "identifier" ) ] ) for record in carrier . auxiliary_data_records : lines . append ( ( indent + "auxiliary data" , ) ) lines . append ( ( 2 * indent + "record type" , record . type ) ) lines . append ( ( 2 * indent + "record data" , repr ( record . data ) ) ) lwidth = max ( [ len ( line [ 0 ] ) for line in lines ] ) lines = [ ( line [ 0 ] . ljust ( lwidth ) , ) + line [ 1 : ] for line in lines ] lines = [ " = " . join ( line ) for line in lines ] return ( "\n" ) . join ( [ indent + line for line in lines ] )
Returns a string with a formatted representation that might
        be considered pretty-printable.