'Return the disk space used for this HDA relevant to user quotas.
If the user has multiple instances of this dataset, it will not affect their
disk usage statistic.'

def quota_amount(self, user):

    rval = 0
    if (not user):
        return rval
    if ((not self.dataset.library_associations) and (not self.purged) and (not self.dataset.purged)):
        for hda in self.dataset.history_associations:
            if (hda.id == self.id):
                continue
            if ((not hda.purged) and hda.history and hda.history.user and (hda.history.user == user)):
                break
        else:
            rval += self.get_total_size()
    for child in self.children:
        rval += child.get_disk_usage(user)
    return rval
