import re


def _name(user_filename):
    """Parse base name from user_filename

    Can't assume the file separators will be understood so have to
    parse out the name manually.

    Will need to be uniquely named by sirepo.server, but not done
    yet.

    Args:
        user_filename (str): Passed in from browser

    Returns:
        str: suitable name
    """
    # crude but good enough for now.
    m = re.search(r'([^:/\\]+)\.\w+$', user_filename)
    return m.group(1) if m else user_filename