Calculate a rough estimate of object size, based on the sizes of
    all versions of all datastreams.  If archive is true, adjusts
    the size estimate of managed datastreams for base64 encoded data.

def estimate_object_size(obj, archive=True):
    '''Calculate a rough estimate of object size, based on the sizes of
    all versions of all datastreams.  If archive is true, adjusts
    the size estimate of managed datastreams for base64 encoded data.
    '''
    size_estimate = 250000   # initial rough estimate for foxml size
    for ds in obj.ds_list:
        dsobj = obj.getDatastreamObject(ds)
        for version in dsobj.history().versions:
            if archive and version.control_group == 'M':
                size_estimate += base64_size(version.size)
            else:
                size_estimate += version.size

    return size_estimate