A security guard had a terrifying encounter when he narrowly avoided being attacked by a 5.5m python while on patrol at Tawau Community College.