def _merkle_hash256(*args):
    """The default transform provided to merkle(), which calculates the hash
    of its parameters, serializes and joins them together, then performs a
    has256 of the resulting string. There are two special cases: no arguments,
    which results in 0, and a single argument, whose hash value is returned
    unmodified."""
    # Return zero-hash is no arguments are provided (the hash of an empty
    # Merkle tree is defined to be zero).
    if not args:
        return 0
    # This helper function extracts and returns the hash value of a parameter.
    # Note that if the parameter is itself a Merkle tree or iterable, this
    # results in a recursive call to merkle().
    def _to_hash(h):
        if isinstance(h, numbers.Integral):
            return h
        if hasattr(h, 'hash'):
            return h.hash
        return merkle(h)
    # As a special case, a tree of length 1 is simply ungrouped - that single
    # hash value is returned to the user as-is.
    if len(args) == 1:
        return _to_hash(args[0])
    # Otherwise we are given two parameters, the hash values of which we
    # serialize, concatenate, and return the hash of.
    return hash256(b''.join(map(lambda h:hash256.serialize(h),
                                map(_to_hash, args)))).intdigest()