You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: envelope.rb
    path of file: ./repos/sentry-ruby/sentry-ruby/lib/sentry
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Sent
    
      def serialize
        result = to_s

        if result.bytesize > MAX_SERIALIZED_PAYLOAD_SIZE
          remove_breadcrumbs!
          result = to_s
        end