def between_markers(text, begin, end):
    start = text.find(begin) + len(begin) if begin in text else 0
    end = text.find(end) if end in text else len(text)
    return text[start:end]


assert between_markers('What is >apple<', '>', '<') == "apple", "One sym"
assert between_markers("<head><title>My new site</title></head>",
                       "<title>", "</title>") == "My new site", "HTML"
assert between_markers('No[/b] hi', '[b]', '[/b]') == 'No', 'No opened'
assert between_markers('No [b]hi', '[b]', '[/b]') == 'hi', 'No close'
assert between_markers(
    'No hi', '[b]', '[/b]') == 'No hi', 'No markers at all'
assert between_markers('No <hi>', '>', '<') == '', 'Wrong direction'
print('Test Done!')

92c8cd8397eeef30802cd8effbcd7d2f1feba132
<mask token>

def between_markers(text, begin, end):
    start = text.find(begin) + len(begin) if begin in text else 0
    end = text.find(end) if end in text else len(text)
    return text[start:end]


<mask token>

def between_markers(text, begin, end):
    start = text.find(begin) + len(begin) if begin in text else 0
    end = text.find(end) if end in text else len(text)
    return text[start:end]


assert between_markers('What is >apple<', '>', '<') == 'apple', 'One sym'
assert between_markers('<head><title>My new site</title></head>', '<title>',
    '</title>') == 'My new site', 'HTML'
assert between_markers('No[/b] hi', '[b]', '[/b]') == 'No', 'No opened'
assert between_markers('No [b]hi', '[b]', '[/b]') == 'hi', 'No close'
assert between_markers('No hi', '[b]', '[/b]') == 'No hi', 'No markers at all'
assert between_markers('No <hi>', '>', '<') == '', 'Wrong direction'
print('Test Done!')

def between_markers(text, begin, end):
    start = text.find(begin) + len(begin) if begin in text else 0
    end = text.find(end) if end in text else len(text)
    return text[start:end]


assert between_markers('What is >apple<', '>', '<') == "apple", "One sym"
assert between_markers("<head><title>My new site</title></head>",
                       "<title>", "</title>") == "My new site", "HTML"
assert between_markers('No[/b] hi', '[b]', '[/b]') == 'No', 'No opened'
assert between_markers('No [b]hi', '[b]', '[/b]') == 'hi', 'No close'
assert between_markers(
    'No hi', '[b]', '[/b]') == 'No hi', 'No markers at all'
assert between_markers('No <hi>', '>', '<') == '', 'Wrong direction'
print('Test Done!')
