convert pub_dates into ArticleDate objects and add them to article

def build_pub_dates(article, pub_dates):
    "convert pub_dates into ArticleDate objects and add them to article"
    for pub_date in pub_dates:
        # always want a date type, take it from pub-type if must
        if pub_date.get('date-type'):
            date_instance = ea.ArticleDate(pub_date.get('date-type'),
                                           pub_date.get('date'))
        elif pub_date.get('pub-type'):
            date_instance = ea.ArticleDate(pub_date.get('pub-type'),
                                           pub_date.get('date'))
        # Set more values
        utils.set_attr_if_value(date_instance, 'pub_type', pub_date.get('pub-type'))
        utils.set_attr_if_value(date_instance, 'publication_format',
                                pub_date.get('publication-format'))
        utils.set_attr_if_value(date_instance, 'day', pub_date.get('day'))
        utils.set_attr_if_value(date_instance, 'month', pub_date.get('month'))
        utils.set_attr_if_value(date_instance, 'year', pub_date.get('year'))
        article.add_date(date_instance)