Added missing import for functools