def get_asset_title(asset, asset_titlefields):
    """ return asset title using either nickname, popup title,
        display_field, layername:objectid in that order. """
    # get nickname of asset
    nickname = asset.get_value(asset_titlefields["nicknamefield"])
    if nickname != None and nickname != "":
        return nickname
    # get popup title of asset
    popup_title = asset_titlefields["popuptitle"]
    for field in asset_titlefields["popupfields"]:
        popup_title = popup_title.replace("{"+field+"}",
                                          "{0}".format(asset.get_value(field)))
        # strip empty field values
        popup_title = popup_title.replace("None", "")
    if popup_title != None and popup_title != '':
        return popup_title
    # get display field of asset layer
    display_field = asset.get_value(asset_titlefields["displayfield"])
    if display_field != None and display_field != '':
        return display_field
    # if all above are empty, then display layername:objectid
    asset_title = "{0}:{1}".format(asset_titlefields["layername"],\
                   asset.get_value(asset_titlefields["objectidfield"]))
    return asset_title