def ischar(s):
    """Does this object represent a character?"""
    # Adapted from: https://stackoverflow.com/a/14321721 and
    # https://mail.python.org/pipermail/python-list/2007-March/425058.html
    return isinstance(s, str) and bool(s) and s == len(s) * s[0]