Create a new BoundNode representing a given object.

def _createbound(obj):
    """Create a new BoundNode representing a given object."""
    # Start by allowing objects to define custom unbound reference hooks
    try:
        kls = obj._unboundreference_()
    except AttributeError:
        kls = type(obj)
    
    unbound = _createunbound(kls)
    def valueget():
        return obj
    for t in (BoundBitfieldNode, BoundStructureNode, BoundArrayNode):
        if isinstance(unbound, t._unboundtype):
            kls = t
            break
    else:
        kls = BoundSimpleNode
    
    child = kls(unbound, valueget)
    return child