def update_hierarchy(hierarchy, feature_type, parent_types):
    """Break input gff3 line into attributes.

    Determines feature type hierarchy using type and attributes fields.
    """
    if not parent_types:
        if feature_type not in hierarchy:
            hierarchy[feature_type] = {'children': [], 'parents': [], 'rank': 0
                }
        hierarchy[feature_type]['rank'] = 1
    else:
        if feature_type not in hierarchy:
            hierarchy[feature_type] = {'children': [], 'parents': [], 'rank': 0
                }
        hierarchy[feature_type]['parents'] = parent_types
        for p in parent_types:
            if hierarchy.get(p):
                if feature_type not in hierarchy[p]['children']:
                    hierarchy[p]['children'].append(feature_type)
            else:
                hierarchy[p] = {'children': [feature_type], 'parents': [],
                    'rank': 0}
