# Path: rest_framework_tus/compat.py



import os
import six
import sys
import tempfile
import hashlib
from .compat import encode_base64
# -*- coding: utf-8 -*-
from __future__ import unicode_literals





def encode_base64_to_string(data):
    """
    Helper to encode a string or bytes value to a base64 string as bytes

    :param six.text_types data:
    :return six.binary_type:
    """

    if not isinstance(data, six.binary_type):
        if isinstance(data, six.text_type):
            data = data.encode('utf-8')
        else:
            data = six.text_type(data).encode('utf-8')


# Path: rest_framework_tus/compat.py



# Path: rest_framework_tus/utils.py
import os
import six
import sys
import tempfile
import hashlib
from .compat import encode_base64

# -*- coding: utf-8 -*-
from __future__ import unicode_literals





def encode_base64_to_string(data):
    """
    Helper to encode a string or bytes value to a base64 string as bytes

    :param six.text_types data:
    :return six.binary_type:
    """

    if not isinstance(data, six.binary_type):
        if isinstance(data, six.text_type):
            data = data.encode('utf-8')
        else:
            data = six.text_type(data).encode('utf-8')


    return encode_base64(data).decode('ascii').rstrip('\n')