def METHOD_NAME(script):
    """Extracts variables that are assigned in the script.
    Parameters
    ----------
    script: str
    Returns
    -------
    list
        A list of extracted variable names
    """
    def inner(body, only_globals=False):
        assignments = []
        for element in body:
            if isinstance(element, ast.Attribute):
                assignments += [target.attr for target in element.targets
                                if element.value == 'var']
            elif isinstance(element, ast.Assign) and not only_globals:
                for target in element.targets:
                    if isinstance(target, ast.Attribute):
                        # Oldschool assignments to variable store
                        if target.value.id == 'var':
                            assignments.append(target.attr)
                    else:
                        assignments.append(target.id)
            elif isinstance(element, ast.Global):
                assignments += element.names
            elif hasattr(element, 'body'):
                assignments += inner(
                    element.body,
                    only_globals=isinstance(element, ast.FunctionDef))
        return assignments
    try:
        return inner(ast.parse(script).body)
    except Exception as e:
        oslogger.debug(f'failed to extract assignments: {e}')
        return []