def parse_record( self, lines ):
        temp_lines = []
        for line in lines:
            fields = line.rstrip( "\r\n" ).split( None, 1 )
            if len( fields ) == 1:
                fields.append( "" )
            temp_lines.append( fields )
        lines = temp_lines
        motif = TransfacMotif()
        current_line = 0
        while 1:
            if current_line >= len( lines ):
                break
            prefix, rest = lines[ current_line ]
            if prefix not in self.parse_actions:
                current_line += 1
                continue
            action = self.parse_actions[ prefix ]
            if action[0] == "store_single":
                key = action[1]
                setattr( motif, key, rest )
                current_line += 1
            if action[0] == "store_single_list":
                key = action[1]
                if not getattr( motif, key ):
                    setattr( motif, key, [] )
                getattr( motif, key ).append( rest )
                current_line += 1
            if action[0] == "store_single_key_value":
                key = action[1]
                k, v = rest.strip().split( '=', 1 )
                if not getattr( motif, key ):
                    setattr( motif, key, {} )
                getattr( motif, key )[k] = v
                current_line += 1
            if action[0] == "store_block":
                key = action[1]
                value = []
                while current_line < len( lines ) and lines[ current_line ][0] == prefix:
                    value.append( lines[current_line][1] )
                    current_line += 1
                setattr( motif, key, str.join( "\n", value ) )
            if action[0] == "store_matrix":
                alphabet = rest.split()
                alphabet_size = len( alphabet )
                rows = []
                pattern = ""
                current_line += 1
                while current_line < len( lines ):
                    prefix, rest = lines[ current_line ]
                    if not prefix.isdigit():
                        break
                    values = rest.split()
                    rows.append( [ float(_) for _ in values[:alphabet_size] ] )
                    if len( values ) > alphabet_size:
                        pattern += values[alphabet_size]
                    current_line += 1
                if len( pattern ) != len( rows ):
                    pattern = None
                matrix = FrequencyMatrix.from_rows( alphabet, rows )
                setattr( motif, action[1], matrix )
        if motif.id or motif.accession or motif.name:
            return motif