def add_certificate_subject(subject, spec):
    """ Utility method to build a subject data structure along
        k8s Certificate resources. This method supports addition of
        Organization (O), OrganizationalUnits (OU), Country (C) and
        State/Province (ST).

        :param subject: a dictionary with keys respective to the
        subject fields mentioned above.
        :param spec: a dicitionary specifying the Certificate.spec that
        is going to be used on the resource creation.
    """
    certificate_subject = {}
    # the template we're using to build Certificate resource doesn't
    # accept fields with None or empty values. We just add fields below
    # if they are specified by the user, otherwise we simply ignore them.
    if subject.get('O'):
        spec['organization'] = [subject.get('O')]
    if subject.get('CN'):
        spec['commonName'] = subject.get('CN')
    if subject.get('OU'):
        certificate_subject['organizationalUnits'] = [subject.get('OU')]
    if subject.get('C'):
        certificate_subject['countries'] = [subject.get('C')]
    if subject.get('ST'):
        certificate_subject['provinces'] = [subject.get('ST')]
    if subject.get('L'):
        certificate_subject['localities'] = [subject.get('L')]
    spec['subject'] = certificate_subject
    return spec