docs: def sign(self, identity, blob):
          """Sign given blob and return the signature (as bytes)."""
          path = _expand_path(identity.get_bip32_address(ecdh=False))
          if identity.identity_dict['proto'] == 'ssh':
              ins = '04'
              p1 = '00'
          else:
              ins = '08'
              p1 = '00'
          if identity.curve_name == 'nist256p1':
              p2 = '81' if identity.identity_dict['proto'] == 'ssh' else '01'
          else:
              p2 = '82' if identity.identity_dict['proto'] == 'ssh' else '02'
          apdu = '80' + ins + p1 + p2
          apdu = binascii.unhexlify(apdu)
          apdu += bytearray([len(blob) + len(path) + 1])
          apdu += bytearray([len(path) // 4]) + path
          apdu += blob
          log.debug('apdu: %r', apdu)
          result = bytearray(self.conn.exchange(bytes(apdu)))
          log.debug('result: %r', result)
          if identity.curve_name == 'nist256p1':
              offset = 3
              length = result[offset]
              r = result[offset+1:offset+1+length]
              if r[0] == 0:
                  r = r[1:]
              offset = offset + 1 + length + 1
              length = result[offset]
              s = result[offset+1:offset+1+length]
              if s[0] == 0:
                  s = s[1:]
              offset = offset + 1 + length
              return bytes(r) + bytes(s)
          else:
              return bytes(result[:64])