method to execute external commands python