from typing import Union


def detect_symbol_format(option_symbol: str) -> Union[str, bool]:
    """
    Detect what format a symbol is formed in. Returns ``polygon`` or ``tda`` depending on which format the symbol is
    in. Returns False if the format doesn't match any of the two supported.

    :param option_symbol: The option symbol to check.
    :return: ``tda`` or ``polygon`` if format is recognized. ``False`` otherwise.
    """
    if option_symbol.startswith('.') or ('_' in option_symbol):
        return 'tda'

    if option_symbol.startswith('O:') or len(option_symbol) > 15:
        return 'polygon'

    return False