'Check if file exists, fix if file in cache and not on Pithos+
:returns: weather the file exists remotely or in cache'

def exists(self, obj, **kwargs):

    path = self._construct_path(obj, **kwargs)
    try:
        self.pithos.get_object_info(path)
        return True
    except ClientError as ce:
        if (ce.status not in (404,)):
            raise
    in_cache = self._in_cache(path)
    dir_only = kwargs.get('dir_only', False)
    if dir_only:
        base_dir = kwargs.get('base_dir', None)
        if in_cache:
            return True
        elif base_dir:
            if (not os.path.exists(path)):
                os.makedirs(path)
            return True
        return False
    if in_cache:
        cache_path = self._get_cache_path(path)
        with open(cache_path) as f:
            self.pithos.upload_object(path, f)
        return True
    return False
