def ticket_name(branch_name):
    """
    Assume the naming convention <ticket_no><underscore><description>
    and return <ticket_no>

    Where: <underscore>  -> "_"

    The delimiter is an <underscore>
    In case this is not respected it will return the token
    up to the first <underscore>, or everything if none is found.

    :param str branch_name: name of the branch we are currently in
    :return: ticket number from the branch
    """
    ticket_no, _, _ = branch_name.partition("_")
    return ticket_no