def get_setting(key, paired_attributes, meta=None, default_value="", remove=False):
    """
    Looks at the attributes of the code and the metadata of the document (in that order) and returns the value when it
    finds one with the specified key.

    :param key: The key or keys that should be searched for. Only the result for the first key found will be returned.
    :type key: str | list[str]
    :param paired_attributes: The attributes for the code.
    :type paired_attributes: dict[str, str]
    :param meta: The metadata of the document.
    :type meta: dict[str, str]
    :param default_value: The value that should be found if the key(s) can't be found.
    :type default_value: str | object
    :param remove: Should the setting be removed from the attributes if it was found there.
    :type remove: bool
    :return: The value that is associated with the key or the default value if key not found.
    :rtype: str | object
    """
    if not isinstance(key, list):
        key = [key]
    for single_key in key:
        if single_key in paired_attributes:
            return paired_attributes.pop(single_key) if remove else paired_attributes[single_key]
        if meta is not None and single_key in meta:
            return meta[single_key]
    return default_value