import mmap
import re


def str_in_file(str_, file_):
    """
    Returns Boolean: True if str_ in file_, otherwise False.
    First converts string to Bytes.
    Uses mmap in order not to read entire file each time.
    """
    b_ = str_.encode()
    with open(file_, 'rb', 0) as file, \
            mmap.mmap(file.fileno(), 0, access=mmap.ACCESS_READ) as s:
        if re.search(b_, s):
            return True
        return False