python check if interactive terminal