'Infer the attribute type of data named name. Currently this only
supports inference of numeric types.
If self.infer_numeric_types is false, type is used. Otherwise, pick the
most general of types found across all values with name and scope. This
means edges with data named \'weight\' are treated separately from nodes
with data named \'weight\'.'

def attr_type(self, name, scope, value):

    if self.infer_numeric_types:
        types = self.attribute_types[(name, scope)]
        try:
            chr(12345)
            local_long = int
            local_unicode = str
        except ValueError:
            local_long = long
            local_unicode = unicode
        if (len(types) > 1):
            if (str in types):
                return str
            elif (local_unicode in types):
                return local_unicode
            elif (float in types):
                return float
            elif (local_long in types):
                return local_long
            else:
                return int
        else:
            return list(types)[0]
    else:
        return type(value)
