def METHOD_NAME(filename: str, ttl_hash: Optional[int] = None) -> str:
    if filename.endswith(".template"):
        return "binary/octet-stream"
    ctype = mimetypes.guess_type(filename)[0]
    if ctype is None:
        ctype = mime.from_file(filename)
    if ctype in ("inode/x-empty"):
        ctype = "binary/octet-stream"
    return ctype