def attributes(path):
<EOL>matches = re.findall('<STR_LIT>', path)<EOL>keys = []<EOL>values = []<EOL>for k,v in matches:<EOL><INDENT>if k in keys:<EOL><INDENT>i = keys.index(k)<EOL>del keys[i]<EOL>del values[i]<EOL><DEDENT>keys.append(k)<EOL>values.append(v)<EOL><DEDENT>lower_keys = [k.lower() for k in keys]<EOL>int_values= [int(v) for v in values]<EOL>attributes = namedtuple('<STR_LIT>', keys + lower_keys)<EOL>return attributes(*values + int_values)<EOL>
Get attributes from path based on format --[A-Z]. Returns namedtuple
    with upper case attributes equal to what found in path (string) and lower
    case as int. If path holds several occurrences of same character, only the
    last one is kept.

        >>> attrs = attributes('/folder/file--X00-X01.tif')
        >>> print(attrs)
        namedtuple('attributes', 'X x')('01', 1)
        >>> print(attrs.x)
        1

    Parameters
    ----------
    path : string

    Returns
    -------
    collections.namedtuple