'Helper method for getting the size of a backend object
If app_inst is provided, we\'ll just parse the dict to get
the size instead of making a separate http request'

def _get_size_2_1(self, volume, tenant=None, app_inst=None, si_name=None, vol_name=None):

    policies = self._get_policies_for_resource(volume)
    si_name = (si_name if si_name else policies['default_storage_name'])
    vol_name = (vol_name if vol_name else policies['default_volume_name'])
    if (not app_inst):
        vol_url = datc.URL_TEMPLATES['ai_inst']().format(datc._get_name(volume['id']))
        app_inst = self._issue_api_request(vol_url, api_version='2.1', tenant=tenant)['data']
    if ('data' in app_inst):
        app_inst = app_inst['data']
    sis = app_inst['storage_instances']
    found_si = None
    for si in sis:
        if (si['name'] == si_name):
            found_si = si
            break
    found_vol = None
    for vol in found_si['volumes']:
        if (vol['name'] == vol_name):
            found_vol = vol
    size = found_vol['size']
    return size
