Construct an AdfKey object from the string.

        Parameters
        ----------
        string : str
            A string.

        Returns
        -------
        adfkey : AdfKey
            An AdfKey object recovered from the string.

        Raises
        ------
        ValueError
            Currently nested subkeys are not supported. If ``subend`` was found
            a ValueError would be raised.

        Notes
        -----
        Only the first block key will be returned.

def from_string(string):
        """
        Construct an AdfKey object from the string.

        Parameters
        ----------
        string : str
            A string.

        Returns
        -------
        adfkey : AdfKey
            An AdfKey object recovered from the string.

        Raises
        ------
        ValueError
            Currently nested subkeys are not supported. If ``subend`` was found
            a ValueError would be raised.

        Notes
        -----
        Only the first block key will be returned.

        """
        def is_float(s):
            if '.' in s or 'E' in s or 'e' in s:
                return True
            else:
                return False

        if string.find("\n") == -1:
            el = string.split()
            if len(el) > 1:
                if string.find("=") != -1:
                    options = list(map(lambda s: s.split("="), el[1:]))
                else:
                    options = el[1:]
                for i, op in enumerate(options):
                    if isinstance(op, list) and is_numeric(op[1]):
                        op[1] = float(op[1]) if is_float(op[1]) else int(op[1])
                    elif is_numeric(op):
                        options[i] = float(op) if is_float(op) else int(op)
            else:
                options = None
            return AdfKey(el[0], options)

        if string.find('subend') != -1:
            raise ValueError("Nested subkeys are not supported!")

        key = None
        for line in iterlines(string):
            if line == "":
                continue
            el = line.strip().split()
            if len(el) == 0:
                continue
            if el[0].upper() in AdfKey.block_keys:
                if key is None:
                    key = AdfKey.from_string(line)
                else:
                    return key
            elif el[0].upper() == 'END':
                return key
            elif key is not None:
                key.add_subkey(AdfKey.from_string(line))
        else:
            raise Exception("IncompleteKey: 'END' is missing!")