# Path: smc/compat.py
# PY3 = sys.version_info > (3,)
# def min_smc_version(version):
# 
# Path: smc/base/util.py
# def save_to_file(filename, content):
#     """
#     Save content to file. Used by node initial contact but
#     can be used anywhere.
# 
#     :param str filename: name of file to save to
#     :param str content: content to save
#     :return: None
#     :raises IOError: permissions issue saving, invalid directory, etc
#     """
#     import os.path
#     path = os.path.abspath(filename)
#     with open(path, "w") as text_file:
#         text_file.write("{}".format(content))
# 
# Path: smc/api/exceptions.py
# class CertificateImportError(CertificateError):
#     """
#     Failure to import a certificate or private key
#     """
# 
# class CertificateExportError(CertificateError):
#     """
#     Failure to export a certificate
#     """


import re
from smc.compat import unicode
from smc.base.util import save_to_file
from smc.api.exceptions import CertificateImportError, CertificateExportError
    cert_type_matches = []
    for match in _PEM_RE.finditer(cert_chain):
        cert_type_matches.append((match.group(1), match.group(0)))
    
    if not cert_type_matches:
        raise ValueError('No certificate types were found. Valid types '
            'are: {}'.format(CERT_TYPES))

    return cert_type_matches
    

class ImportExportCertificate(object):
    """
    Mixin to provide certificate import and export methods to relevant
    classes.
    """
    def import_certificate(self, certificate):
        """
        Import a valid certificate. Certificate can be either a file path
        or a string of the certificate. If string certificate, it must include
        the -----BEGIN CERTIFICATE----- string.
        
        :param str certificate_file: fully qualified path to certificate file
        :raises CertificateImportError: failure to import cert with reason
        :raises IOError: file not found, permissions, etc.
        :return: None
        """
        multi_part = 'signed_certificate' if self.typeof == 'tls_server_credentials'\
            else 'certificate'
        self.make_request(

# Path: smc/compat.py
# PY3 = sys.version_info > (3,)
# def min_smc_version(version):
# 
# Path: smc/base/util.py
# def save_to_file(filename, content):
#     """
#     Save content to file. Used by node initial contact but
#     can be used anywhere.
# 
#     :param str filename: name of file to save to
#     :param str content: content to save
#     :return: None
#     :raises IOError: permissions issue saving, invalid directory, etc
#     """
#     import os.path
#     path = os.path.abspath(filename)
#     with open(path, "w") as text_file:
#         text_file.write("{}".format(content))
# 
# Path: smc/api/exceptions.py
# class CertificateImportError(CertificateError):
#     """
#     Failure to import a certificate or private key
#     """
# 
# class CertificateExportError(CertificateError):
#     """
#     Failure to export a certificate
#     """


# Path: smc/administration/certificates/tls_common.py
import re
from smc.compat import unicode
from smc.base.util import save_to_file
from smc.api.exceptions import CertificateImportError, CertificateExportError

    cert_type_matches = []
    for match in _PEM_RE.finditer(cert_chain):
        cert_type_matches.append((match.group(1), match.group(0)))
    
    if not cert_type_matches:
        raise ValueError('No certificate types were found. Valid types '
            'are: {}'.format(CERT_TYPES))

    return cert_type_matches
    

class ImportExportCertificate(object):
    """
    Mixin to provide certificate import and export methods to relevant
    classes.
    """
    def import_certificate(self, certificate):
        """
        Import a valid certificate. Certificate can be either a file path
        or a string of the certificate. If string certificate, it must include
        the -----BEGIN CERTIFICATE----- string.
        
        :param str certificate_file: fully qualified path to certificate file
        :raises CertificateImportError: failure to import cert with reason
        :raises IOError: file not found, permissions, etc.
        :return: None
        """
        multi_part = 'signed_certificate' if self.typeof == 'tls_server_credentials'\
            else 'certificate'
        self.make_request(

            CertificateImportError,