import re
from typing import List


def _get_args_str(code_str: str, func_name: str) -> str:
    """
    Get the string of the arguments.

    Parameters
    ----------
    code_str : str
        String of target Python code.
    func_name : str
        Target function name.

    Returns
    -------
    args_str : str
        String of arguments. e.g., 'location_id, price=100'
    """
    search_pattern: str = f'def {func_name}'
    search_pattern = search_pattern + r'.*?\(.*?\)'
    code_str = re.sub(pattern=r'\n', repl='', string=code_str)
    searched_result_list: List[str] = re.findall(
        pattern=search_pattern, string=code_str)
    searched_result_str: str = ''
    for searched_str_unit in searched_result_list:
        searched_func_name: str = searched_str_unit.split('(')[0]
        searched_func_name = searched_func_name.replace(
            'def ', '')
        searched_func_name = searched_func_name.strip()
        if searched_func_name == func_name:
            searched_result_str = searched_str_unit
            break
    if searched_result_str == '':
        return searched_result_str

    args_str: str = searched_result_str.split('def ')[1]
    args_str = args_str.split('(')[1]
    args_str = args_str.split(')')[0]
    args_str = args_str.strip()
    while args_str.find('  ') != -1:
        args_str = args_str.replace('  ', ' ')
    return args_str