import re


def smart_tensor_name(t):
    """
    For check_placeholders and check_tensors functions, the tensors
    can either be the correct tensor name (finishing with :digit) or
    operation names. If user provided operations (common error in tensorflow),
    the method will assing :0 to each of them to get the tensor name.
    """
    m = re.search(r':\d+$', t)
    if m is None:
        return "{}:0".format(t)
    return t