func (n *Name) IsRegistered() (bool, error) {
	registrant, err := n.Registrant()
	if err != nil {
		return false, err
	}
	return registrant != UnknownAddress, nil
}
IsRegistered returns true if the name is registered in the registrar
package ens
import (
	"crypto/rand"
	"errors"
	"fmt"
	"math/big"
	"time"
	"github.com/ethereum/go-ethereum/accounts/abi/bind"
	"github.com/ethereum/go-ethereum/common"
	"github.com/ethereum/go-ethereum/core/types"
)
type Name struct {
	backend bind.ContractBackend
	Name string
	Domain string
	Label string
	registry   *Registry
	registrar  *BaseRegistrar
	controller *ETHController
}
func NewName(backend bind.ContractBackend, name string) (*Name, error) {
	name, err := NormaliseDomain(name)
	if err != nil {
		return nil, err
	}
	domain := Domain(name)
	label, err := DomainPart(name, 1)
	if err != nil {
		return nil, err
	}
	registry, err := NewRegistry(backend)
	if err != nil {
		return nil, err
	}
	registrar, err := NewBaseRegistrar(backend, domain)
	if err != nil {
		return nil, err
	}
	controller, err := NewETHController(backend, domain)
	if err != nil {
		return nil, err
	}
	isValid, err := controller.IsValid(name)
	if err != nil {
		return nil, err
	}
	if !isValid {
		return nil, errors.New("name is not valid according to the rules of the registrar (too short, invalid characters, etc.)")
	}
	return &Name{
		backend:    backend,
		Name:       name,
		Domain:     domain,
		Label:      label,
		registry:   registry,
		registrar:  registrar,
		controller: controller,
	}, nil
}