Function for current distance between in light-seconds between Mars and Earth I'm looking for a function that given a time (for example Unix time) gives back the current distance between Mars and Earth in light-seconds.

It can be a mathematical function or programming function (preferably in Python or pseudocode), but must not rely on an Internet connection.

This question is similar to a question I asked erlier, but again I need to get the distance without an Internet connection.

Thanks in advance!

Sidenote: I'm planning on learning orbital mechanics, but I need this function earlier. :)
There is no simple function that is accurate. Both Earth and Mars are orbiting in ellipses (Kepler's first law). They are travelling at varying speeds (Kepler's second). To find the current distance between them you have to calculate their positions in three dimensions. 

In other words you have to do orbital kinematics. How do I calculate the positions of objects in orbit?

If accuracy is not important. You can approximate the orbits with circles in the same plane. The Earths position is then
$$(\cos(2\pi t + \alpha), \sin(2\pi t +\alpha))$$ 
and Mars is 
$$(1.5\cos(2\pi t/1.882 +\beta), 1.5\sin(2\pi t/1.882 + \beta))$$

The distance between them is calculated by pythagoras

The distances are in AU and the time is in years (converting to lightseconds is then easy). $\alpha$ and $\beta$ are constants chosen to fit the positions of the planets at time 0. The values 1.5 and 1.882 are chosen because Mars's orbit is about 1.5 times bigger than Earth, and a Mars year is 1.882 times longer than Earth. 

The circular approximation however is poor for Mars, and this ignores the fact that Mars isn't in exactly the same orbital plane as the earth, so the values will only be rather approximate.