Write a simple test script for validating a web form submission.
Implement validate_form_submission(form) to validate a form containing name, email, password, and terms_accepted. Return a list of error codes in the required order: name_required, email_invalid, password_invalid, and terms_required. Return an empty list when all fields are valid.
Rules: name must be non-empty after trimming, email must contain one @ with non-empty parts and a dot in the domain, password must be at least eight characters with an uppercase letter, lowercase letter, and digit, and terms_accepted must be True.
def validate_form_submission(form):