def not_next(e):
    """
    Create a PEG function for negative lookahead.
    """
    def match_not_next(s, grm=None, pos=0):
        try:
            e(s, grm, pos)
        except PegreError as ex:
            return PegreResult(s, Ignore, (pos, pos))
        else:
            raise PegreError('Negative lookahead failed', pos)
    return match_not_next