def extract_groups_cores(grouped_jobs, max_cores=None):
    """Processes the list of task names to group, extracting the max number of
    cores per task. The grouped task name can have the format:
    task_name:num_cores or just task_name. If num_cores is set, the max_cores
    is used instead.
    Args:
    - grouped_jobs: list of strings of the format task_name or
        task_name:num_cores. Task_name refers to the name field of tasks to 
        be grouped. num_cores to the maximum number of cores assigned to that
        tasks group.
    - max_cores: maximum number of cores used to group tasks in no specific
        value is set.
    Returns 
    - new_groups: list of names of grouped tasks.
    - max_cores_dic: dictionary of integers with the maximum number of cores
        per grouped tasks indexed by the name of grouped tasks.
    
    """
    new_groups = []
    max_cores_dic = {}
    for gr in grouped_jobs:
        if ":" in gr:
            tokens = gr.split(":")
            new_groups.append(tokens[0])
            max_cores_dic[tokens[0]]=(int(tokens[1]))
        else:
            new_groups.append(gr)
            max_cores_dic[gr]=max_cores
    return new_groups, max_cores_dic