def encode_file(body, filename):
    """
    Encode a file in a binary form and return a mime content type
    and encoded binary data

    :param body: binary data to encode
    :param filename: name of file with data to encode
    :return: content_type, body
    """
    boundary = '--------------MIME_Content_Boundary---------------'
    lines = []
    lines.append('--' + boundary)
    lines.append('Content-Disposition: form-data; name="input_file"; '
                 'filename="{0}"'.format(filename))
    lines.append('Content-Type: application/octet-stream')
    lines.append('')
    lines.append(body)
    lines.append('--' + boundary + '--')
    lines.append('')
    encoded = "\r\n".join(lines)
    content_type = 'multipart/form-data; boundary=%s' % boundary
    return content_type, encoded