def METHOD_NAME(module, comment, email, name, state, ttl):
    changed = False
    dns = pyrax.cloud_dns
    if not dns:
        module.fail_json(msg='Failed to instantiate client. This '
                             'typically indicates an invalid region or an '
                             'incorrectly capitalized region name.')
    if state == 'present':
        if not email:
            module.fail_json(msg='An "email" attribute is required for '
                                 'creating a domain')
        try:
            domain = dns.find(name=name)
        except pyrax.exceptions.NoUniqueMatch as e:
            module.fail_json(msg='%s' % e.message)
        except pyrax.exceptions.NotFound:
            try:
                domain = dns.create(name=name, emailAddress=email, ttl=ttl,
                                    comment=comment)
                changed = True
            except Exception as e:
                module.fail_json(msg='%s' % e.message)
        update = {}
        if comment != getattr(domain, 'comment', None):
            update['comment'] = comment
        if ttl != getattr(domain, 'ttl', None):
            update['ttl'] = ttl
        if email != getattr(domain, 'emailAddress', None):
            update['emailAddress'] = email
        if update:
            try:
                domain.update(**update)
                changed = True
                domain.get()
            except Exception as e:
                module.fail_json(msg='%s' % e.message)
    elif state == 'absent':
        try:
            domain = dns.find(name=name)
        except pyrax.exceptions.NotFound:
            domain = {}
        except Exception as e:
            module.fail_json(msg='%s' % e.message)
        if domain:
            try:
                domain.delete()
                changed = True
            except Exception as e:
                module.fail_json(msg='%s' % e.message)
    module.exit_json(changed=changed, domain=rax_to_dict(domain))