def pem2b64(pem):
    """
    Strip the header and footer of a .pem. BEWARE: Won't work with explanatory
    strings above the header.
    @params pem A string representing the pem
    """
    pem = pem.decode('ascii')
    return '\n'.join(pem.strip().split('\n')[1:-1])
