import six


def pystr(s):
    """
    Cross-version support for convertin a string of characters to Python str object
    """
    if six.PY2 and isinstance(s, six.text_type):
        return s.encode('ascii', 'ignore')
    elif six.PY3 and isinstance(s, six.binary_type):
        return s.decode('utf-8')
    else:
        return s