code: def dump_service(self, sc):
          
          def lprint(fmt, data, index):
              ispchr = lambda x: x >= 32 and x <= 126  # noqa: E731
  
              def print_bytes(octets):
                  return ' '.join(['%02x' % x for x in octets])
  
              def print_chars(octets):
                  return ''.join([chr(x) if ispchr(x) else '.' for x in octets])
  
              return fmt.format(index, print_bytes(data), print_chars(data))
  
          data_line_fmt = "{0:04X}: {1} |{2}|"
          same_line_fmt = "{0:<4s}  {1} |{2}|"
  
          lines = list()
          last_data = None
          same_data = 0
  
          for i in itertools.count():  # pragma: no branch
              assert i < 0x10000
              try:
                  this_data = self.read_without_encryption([sc], [BlockCode(i)])
              except Type3TagCommandError:
                  i = i - 1
                  break
  
              if this_data == last_data:
                  same_data += 1
              else:
                  if same_data > 1:
                      lines.append(lprint(same_line_fmt, last_data, "*"))
                  lines.append(lprint(data_line_fmt, this_data, i))
                  last_data = this_data
                  same_data = 0
  
          if same_data > 1:
              lines.append(lprint(same_line_fmt, last_data, "*"))
          if same_data > 0:
              lines.append(lprint(data_line_fmt, this_data, i))
  
          return lines
docs: Read all data blocks of a given service.
  
          :meth:`dump_service` reads all data blocks from the service
          with service code *sc* and returns a list of strings suitable
          for printing. The number of strings returned does not
          necessarily reflect the number of data blocks because a range
          of data blocks with equal content is reduced to fewer lines of
          output.