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: write.go
    path of file: ./repos/td/mtproto
    
    the code of the file until where you have to start completion: package mtproto

import (
	"context"

	"github.com/gotd/td/bin"
)

func (c *Conn) writeContentMessage(ctx context.Context, msgID int64, seqNo int32, message bin.Encoder) error {
	return c.write(ctx, msgID, seqNo, message)
}

func (c *Conn) writeServiceMessage(ctx context.Context, message bin.Encoder) error {
	msgID, seq
    
func (c *Conn) write(ctx context.Context, msgID int64, seqNo int32, message bin.Encoder) error {
	// Grab shared lock for writing.
	// It prevents message sending during key regeneration if server forgot current auth key.
	c.exchangeLock.RLock()
	defer c.exchangeLock.RUnlock()

	b := bufPool.Get()
	defer bufPool.Put(b)

	if err := c.newEncryptedMessage(msgID, seqNo, message, b); err != nil {
		return err
	}

	if err := c.conn.Send(ctx, b); err != nil {
		return err
	}

	return nil
}