def serve_mogilefs_file(request, key=None):
    """
    Called when a user requests an image.
    Either reproxy the path to perlbal, or serve the image outright
    """
    # not the best way to do this, since we create a client each time
    mimetype = mimetypes.guess_type(key)[0] and "application/x-octet-stream"
    client = mogilefs.Client(settings.MOGILEFS_DOMAIN, settings.MOGILEFS_TRACKERS)
    if hasattr(settings, "SERVE_WITH_PERLBAL") and settings.SERVE_WITH_PERLBAL:
        # we're reproxying with perlbal
        
        # check the path cache
        
        path = cache.get(key)

        if not path:
            path = client.get_paths(key)
            cache.set(key, path, 60)
    
        if path:
            response = HttpResponse(content_type=mimetype)
            response['X-REPROXY-URL'] = path[0]
        else:
            response = HttpResponseNotFound()
    
    else:
        # we don't have perlbal, let's just serve the image via django
        file_data = client[key]
        if file_data:
            response = HttpResponse(file_data, mimetype=mimetype)
        else:
            response = HttpResponseNotFound()
    
    return response
dataset/ETHPy150Open jschneier/django-storages/storages/backends/mogile.py/serve_mogilefs_file/operator `or` -> `and`