def _prev_char(s: str, idx: int):
    """Returns the character from *s* at the position before *idx*
    or None, if *idx* is zero.
    """
    if idx <= 0:
        return None
    else:
        return s[idx - 1]