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

import (
	"encoding/json"
	"fmt"
)

type sumtype struct {
	TypeVal string `json:"type"`
}

// MarshalJSON implements the Marshaller interface for Blocks so that any JSON
// marshalling is delegated and proper type determination can be made before marshal
func (b Blocks) MarshalJSON() ([]byte, error) {
	bytes, err := json.Marshal(b.BlockSet)
	if err != nil {
		return nil, err
	}

	return bytes, nil
}

    
func toBlockElement(element *Accessory) BlockElement {
	if element.ImageElement != nil {
		return element.ImageElement
	}
	if element.ButtonElement != nil {
		return element.ButtonElement
	}
	if element.OverflowElement != nil {
		return element.OverflowElement
	}
	if element.DatePickerElement != nil {
		return element.DatePickerElement
	}
	if element.TimePickerElement != nil {
		return element.TimePickerElement
	}
	if element.PlainTextInputElement != nil {
		return element.PlainTextInputElement
	}
	if element.RadioButtonsElement != nil {
		return element.RadioButtonsElement
	}
	if element.CheckboxGroupsBlockElement != nil {
		return element.CheckboxGroupsBlockElement
	}
	if element.SelectElement != nil {
		return element.SelectElement
	}
	if element.MultiSelectElement != nil {
		return element.MultiSelectElement
	}

	return nil
}