def _connect_to_ec2(region, credentials):
conn = boto.ec2.connect_to_region(<EOL>region,<EOL>aws_access_key_id=credentials.access_key_id,<EOL>aws_secret_access_key=credentials.secret_access_key<EOL>)<EOL>if conn:<EOL><INDENT>return conn<EOL><DEDENT>else:<EOL><INDENT>log_red('<STR_LIT>')<EOL>return False<EOL><DEDENT>
:param region: The region of AWS to connect to.
:param EC2Credentials credentials: The credentials to use to authenticate
    with EC2.

:return: a connection object to AWS EC2