Ref : https://github.com/python/cpython/pull/25174

https://github.com/localstack/localstack/blob/5a5edcd9d9ccbd6a56f23d71e3a1131b8c814996/localstack/utils/common.py#L324
out = run('whoami').strip()
    return out == 'root'
def cleanup_resources(debug=False):
    cleanup_tmp_files()
    cleanup_threads_and_processes(debug=debug)
def print_debug(msg, debug=False):
    if debug:
        print(msg)
@synchronized(lock=SSL_CERT_LOCK)
def generate_ssl_cert(target_file=None, overwrite=False, random=False, return_content=False, serial_number=None):
    
    
    from OpenSSL import crypto
    def all_exist(*files):
        return all([os.path.exists(f) for f in files])
    def store_cert_key_files(base_filename):
        key_file_name = '%s.key' % base_filename
        cert_file_name = '%s.crt' % base_filename
        
        
        content = load_file(target_file)
        key_start = re.search(r'-----BEGIN(.*)PRIVATE KEY-----', content)
        key_start = key_start.group(0)
        key_end = re.search(r'-----END(.*)PRIVATE KEY-----', content)
        key_end = key_end.group(0)
        cert_start = '-----BEGIN CERTIFICATE-----'
        cert_end = '-----END CERTIFICATE-----'
        key_content = content[content.index(key_start): content.index(key_end) + len(key_end)]
        cert_content = content[content.index(cert_start): content.rindex(cert_end) + len(cert_end)]