def parse_map(filterfun, parser):
    """Creates a new parser that passes the result of the given parser through
	the given filterfun.

	>>> list(parse_map(int, (None, "42")))
	[None, 42]

	@type filterfun: obj -> obj
	@param parser: parser
	@returns: parser
	"""
    for element in parser:
        if element is None:
            yield None
        else:
            yield filterfun(element)
            break
