def should_concat(prev_type, cur_type):
    """This function contains the logic deciding if the current node should be grouped with the previous node in the same notebook cell.

    Args:
    prev_type: (str) type of the previous node.
    cur_type: (str) type of the current node.

    Returns
    A Boolean
    """
    concat_types = ['Import', 'ImportFrom', 'Assign']
    import_types = ['Import', 'ImportFrom']

    if prev_type == cur_type and cur_type in concat_types:
        return True

    if prev_type in import_types and cur_type in import_types:
        return True

    return False