from typing import Tuple
import re


def get_line_property_key_value(text: str, reversed_key: bool) -> Tuple[str, str]:
    """Returns the unformatted key and formatted value for a given line.
    Examples:
        reversed_key = False
        key= value 123 -> key, value
        reversed_key = True
        value 123= key asdf -> key, value

    Args:
        text (str): Text from where to extract key and value.
        reversed_key (bool): Whether the key comes before or after the value.

    Returns:
        Tuple[str, str]: Unformatted key and formatted value.
    """
    key_idx, value_idx = (-1, 0) if reversed_key else (0, -1)
    text_parts = re.split(":|=", text.strip())
    key_part = ""
    if len(text_parts) > 1:
        # Only consider a value if there is more than one field.
        key_part = text_parts[key_idx].strip()
    value_part = text_parts[value_idx].strip()
    if value_part:
        # If there was a value in the first field, clean it.
        return key_part, re.split(" ", value_part)[0].strip()
    return key_part, ""