@classmethod
def _convert_nexthops(cls, nexthops):
    """ Convert list of nexthop objects into command list. """
    nextargs = []
    for nexthop in nexthops:
        nextargs.append('nexthop')
        for key in ('via', 'dev', 'weight'):
            nextargs.append(key)
            nextargs.append(str(getattr(nexthop, key)))
    return nextargs
