def as_ascii(input_string):
    """Helper function to parse a byte string to an ascii string if necessary"""

    try:
        return input_string.decode('ascii')
    except AttributeError:
        return input_string