docs: def serialize_output(output):
      """ Serializes a transaction output.
      """
      if not ('value' in output and 'script_hex' in output):
          raise Exception('Invalid output')
  
      return ''.join([
          hexlify(struct.pack('<Q', output['value'])), # pack into 8 bites
          hexlify(variable_length_int(len(output['script_hex'])/2)),
          output['script_hex']
      ])