Cartesian coordinates and ellipsoid coordinates python

1.This function converts 3D Cartesian coordinates to ellipsoidal coordinates using GRS80 parameters
2.This function converts ellipsoidal coordinates to Cartesian coordinates using GRS80 parameters
3.This function converts the decimal degree into minute seconds
How can I write these three functions in a python code?

import maths

GRS80 = 6378137, 298.257222100882711

wgs84 = 6378137, 298.257223563

def xyz2ell (x, y, z):

φ = math.radians (latitude)

λ = math.radians (longitude)

e2 = a ** 2-b ** 2 / a ** 2

r = (N + ellHeight) * cos ()

N = a / math.sqrt (1-e2 * math.sin (φ))

x = float ((N + ellHeight) * math.cos (φ) * math.cos (λ))

y = float ((N + ellHeight) * math.cos (φ) * math.sin (λ))

z = float (((1-e2) * N + ellHeight) * math.sin (φ))

latitude, longitude, ellHeight
`` `