by discrimination in regard to hire or tenure of employment or any term or condition of employment to encourage or discourage membership in any labor organization:
Provided, That nothing in this subchapter, or in any other statute of the United States, shall preclude an employer from making an agreement with a labor organization (not established, maintained, or assisted by any action defined in this subsection as an unfair labor practice) to require as a condition of employment membership therein on or after the thirtieth day following the beginning of such employment or the effective date of such agreement, whichever is the later, (i) if such labor organization is the representative of the employees as provided in
section 159(a) of this title, in the appropriate collective-bargaining unit covered by such agreement when made, and (ii) unless following an election held as provided in
section 159(e) of this title within one year preceding the effective date of such agreement, the Board shall have certified that at least a majority of the employees eligible to vote in such election have voted to rescind the authority of such labor organization to make such an agreement:
Provided further, That no employer shall justify any discrimination against an employee for nonmembership in a labor organization (A) if he has reasonable grounds for believing that such membership was not available to the employee on the same terms and conditions generally applicable to other members, or (B) if he has reasonable grounds for believing that membership was denied or terminated for reasons other than the failure of the employee to tender the periodic dues and the initiation fees uniformly required as a condition of acquiring or retaining membership;