def detect(byte_string):
    """
    Detect if a byte string seems to contain a PEM-encoded block

    :param byte_string:
        A byte string to look through

    :return:
        A boolean, indicating if a PEM-encoded block is contained in the byte
        string
    """

    if not isinstance(byte_string, byte_cls):
        raise TypeError(unwrap(
            '''
            byte_string must be a byte string, not %s
            ''',
            _type_name(byte_string)
        ))

    return byte_string.find(b'-----BEGIN') != -1 or byte_string.find(b'---- BEGIN') != -1
def detect ( byte_string ) : if not isinstance ( byte_string , byte_cls ) : raise TypeError ( unwrap ( '''
            byte_string must be a byte string, not %s
            ''' , _type_name ( byte_string ) ) ) return byte_string . find ( b'-----BEGIN' ) != - 1 or byte_string . find ( b'---- BEGIN' ) != - 1
Detect if a byte string seems to contain a PEM-encoded block

    :param byte_string:
        A byte string to look through

    :return:
        A boolean, indicating if a PEM-encoded block is contained in the byte
        string