def binary_freq(data, expression, feature_name=str, analyze=True):
    """Search data for occurrences of a binary feature as a regex.

    Args:
        data (pd.Series): a series with text instances.
        expression (re.compile): a regex or string to search for. 
        feature_name (str, optional): a name for the feature to extract. Defaults to str.

    Returns:
        list: a list with a dict mapping feature name to 1 or 0 (true/false) based on occurrence in texts.
    """

    b = data.str.contains(expression).astype(int)  # cast bools to 0/1
    
    if analyze == True:
        bList = [{feature_name: x[1]} for x in b.items()]
        
        return bList

    else:
        return b