def make_string(x):
    """
    Force object into string and raises a TypeError if object is not of a
    compatible type.
    """
    if isinstance(x, str):
        return str
    elif isinstance(x, bytes):
        return x.decode('utf8')
    else:
        cls_name = type(x).__name__
        raise TypeError(f'expect string type, got {cls_name}')
