easy way to automatically up or down sample data in pandas or keras to a uniform size

Solution for easy way to automatically up or down sample data in pandas or keras to a uniform size
is Given Below:

So I have some time series data that varies in length that I want to build a time series classifier for. I intend to use Keras convolutional and dense layers so I am going to need inputs of a fixed size. I was hoping maybe there would a layer that would automatically resize the data or perhaps a preprocessing function in Keras or pandas.

Let’s say I have 5000 Time series to train. On average each of the time series is 500 samples long but are distributed anywhere from say 300 samples to 900 samples. I would like all of the samples to be the average 500 long. So basically 3 cases if the time series is less than 500 upsample using some interpolation to 500 rows. If its more than the average down sample, maybe by averaging, and if they are 500 long do nothing.

[Edit: Ideally, it would be cool to do this on the keras side so the model could accept any length sequecne]

I was thinking there would be an easy out of the box solution but ive yet to find anything. Any Advice would be appreciatied.