<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def file_response(data: Union[bytes, str], # HttpResponse encodes str if req'd content_type: str, filename: str) -> HttpResponse: """ Returns an ``HttpResponse`` with an attachment containing the specified data with the specified filename as an attachment. """

    response = HttpResponse(data, content_type=content_type)
    add_download_filename(response, filename)
    return response