def get_total_modules(df, weighted):
    """
        Return the total number of modules in the provided DataFrame
        NOTE: All rows marked as 'System' with a null value in 'No.modules' are left out
        
        Args:
            df (DataFrame): Pandas DataFrame that has been cleaned using the clean_data function
            weighted (bool): If true, count all modules in a system
                             If false, count a system as one module
        Returns:
            int: Total modules
    """
    if weighted:
        module_count = df[df['System/module'] == 'Module'].shape[0]
        
        specified = df[(df['System/module'] != 'System') | (df['No.modules'].notnull())]
        system_count = specified[specified['System/module'] != 'Module']['No.modules'].sum()
        
        total_modules = module_count + system_count
        return total_modules
    else:
        return df.shape[0]