Encode and iterable of features as a polyline

def encode_polyline(features):
    """Encode and iterable of features as a polyline
    """
    points = list(read_points(features))
    latlon_points = [(x[1], x[0]) for x in points]
    return polyline.encode(latlon_points)