def filter_out_none(dictionary, keys=None):
    """ Filter out items whose value is None.
        If `keys` specified, only return non-None items with matched key.
    """
    ret = {}
    if keys is None:
        keys = []
    for key, value in dictionary.items():
        if value is None or key not in keys:
            continue
        ret[key] = value
    return ret
