Time in Python is sometimes represented using the struct_time data structure in  the time module or simply as a tuple made of 9 elements i.e  (year, month, day, hour, minute, second, weekday,  day_of_year, dst). The struct_time class simply provides a more structured way of  representing the 9 components of time.

example of a struct_time object

import time

st_obj = time.localtime()

print(st_obj)

The work of the mktime() function.

The mktime() function in the time module converts a struct_time object or a tuple containing the 9 element of time to a Unix timestamp (seconds since the epoch).  

mktime(t)
t struct_time object, or a tuple with time components. 

The function returns a floating point value representing the number seconds since the epoch of the input date.

import time

st_obj = time.localtime()

print(time.mktime(st_obj))

In the above example, we used the time.localtime() function without any argument to get a struct_time object representing the current local time, then we used the mktime() function to convert the struct_time object to the equivalent  timestamp.

With the time components in a tuple

import time

t = (2021, 9, 17, 17, 3, 38, 1, 48, 0)

print(time.mktime(t))