Can you format you code more consistently? Readability is important when asking for help.
Help us help you. Read this link first and learn how to format code so we can help you better. About the Python Help category You will get more help this way.
And do you mean “trail” as in your message, or “trial” which is in your code? I don’t know which you want, or which might be a spelling error.