Rolling Function In Python Definition