def METHOD_NAME(request):
    search_term = request.GET.get('q', '')
    if search_term == '':
        return HttpResponse('', content_type='application/x-suggestions+json')
    cache_key = 'opensearch:packages:' + hashlib.md5(search_term.encode('utf-8')).hexdigest()
    to_json = cache.get(cache_key, None)
    if to_json is None:
        # Package names are lowercase by convention
        q = Q(pkgname__istartswith=search_term)
        names = Package.objects.filter(q).values_list(
            'pkgname', flat=True).order_by('pkgname').distinct()[:10]
        results = (search_term, tuple(names))
        to_json = json.dumps(results, ensure_ascii=False)
        cache.set(cache_key, to_json, 613)
    return HttpResponse(to_json, content_type='application/x-suggestions+json')