def validate_email_to_link(email, raw_email=None, message_template=None, ignore_existing=False):
raw_email = raw_email if raw_email is not None else email<EOL>message_template = message_template if message_template is not None else ValidationMessages.INVALID_EMAIL<EOL>try:<EOL><INDENT>validate_email(email)<EOL><DEDENT>except ValidationError:<EOL><INDENT>raise ValidationError(message_template.format(argument=raw_email))<EOL><DEDENT>existing_record = EnterpriseCustomerUser.objects.get_link_by_email(email)<EOL>if existing_record and not ignore_existing:<EOL><INDENT>raise ValidationError(ValidationMessages.USER_ALREADY_REGISTERED.format(<EOL>email=email, ec_name=existing_record.enterprise_customer.name<EOL>))<EOL><DEDENT>return existing_record or False<EOL>
Validate email to be linked to Enterprise Customer.

Performs two checks:
    * Checks that email is valid
    * Checks that it is not already linked to any Enterprise Customer

Arguments:
    email (str): user email to link
    raw_email (str): raw value as it was passed by user - used in error message.
    message_template (str): Validation error template string.
    ignore_existing (bool): If True to skip the check for an existing Enterprise Customer

Raises:
    ValidationError: if email is invalid or already linked to Enterprise Customer.

Returns:
    bool: Whether or not there is an existing record with the same email address.