def analyze_data(all_data):
    """
    Calculates total cost and number of prescribers for each drug. All unique
    drugs (set of strings) determined using set comprehension. For each drug,
    number of prescribers (integer) determined by list comprehension wrapped
    with sum() function. For each prescriber, gross drug cost (list of floats)
    determined by list comprehension. Net drug cost, accounting for net
    prescriber costs for given drug, determined using prescriber drug costs
    wrapped by sum() function. Processed data saved in dictionary.

    Args:
        all_data (nested dictionary): contains all collected, parsed, and
            organized data. Primary key is drug name (string), and primary
            value is sub-dictionary of prescribers (tuple of strings).
            Secondary key is prescriber name (string) and secondary value is
            drug cost (list of floats).

    Returns:
        processed_data (dictionary): contains all analyzed data. Primary key
            is drug name (string), and primary value is tuple containing
            number of prescribers (integer, index 0) and total cost (float,
            index 1).
    """
    # Sets initial dictionary for analysis data
    processed_data = {}
    # Determines all unique drug names
    all_drugs = {drug for drug in all_data.keys()}
    # Iterates over all unique drug names
    for drug in all_drugs:
        # Creates set of all prescribers for given drug
        all_prescribers = {prescriber for prescriber in all_data[drug].keys()}
        # Calculates total number of prescribers
        num_prescribers = sum([ 1 for prescriber in all_prescribers ])
        # Calculates prescriber net drug cost
        prescriber_costs = [
            sum(all_data[drug][prescriber]) for prescriber in all_prescribers
        ]
        # Calculate gross prescriber cost for given drug
        total_cost = sum(prescriber_costs)
        # Sets tuple of number of prescribers (index 0) and total cost (1)
        processed_data[drug] = (num_prescribers, total_cost)
    # Returns dictionary of analyzed data
    return processed_data