<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:

def _make_regex(pem_type):
    '''
    Dynamically generate a regex to match pem_type
    '''
    return re.compile(
        r"\s*(?P<pem_header>-----BEGIN {0}-----)\s+"
        r"(?:(?P<proc_type>Proc-Type: 4,ENCRYPTED)\s*)?"
        r"(?:(?P<dek_info>DEK-Info: (?:DES-[3A-Z\-]+,[0-9A-F]{{16}}|[0-9A-Z\-]+,[0-9A-F]{{32}}))\s*)?"
        r"(?P<pem_body>.+?)\s+(?P<pem_footer>"
        r"-----END {0}-----)\s*".format(pem_type),
        re.DOTALL
    )