def getmetainfo(content):
    """Get meta information from content text.

    :param str content: source text
    :rtype tuple:
    :return: (timespec, location, pure_content)

    Meta information must be placed on the first or the second line.
    Available options are as follows::

        !20171231T235959
        @home

    or::

        Date: 2017-12-31 23:59:59
        Location: home
    """
    timespec = location = None
    lines = content.splitlines()
    for i, line in enumerate(lines):
        if 1 < i:
            break
        if not line:
            continue
        if line.startswith("!"):
            timespec = line[1:].strip()
        elif ":" in line and line.split(":", 1)[0].upper() == "DATE":
            timespec = line.split(":", 1)[1].strip()
        elif line.startswith("@"):
            location = line[1:].strip()
        elif ":" in line and line.split(":", 1)[0].upper() == "LOCATION":
            location = line.split(":", 1)[1].strip()
        else:
            continue
        lines[i] = None
    return (timespec, location,
            "\n".join(line for line in lines if line is not None))