from typing import Union
from typing import Dict
from typing import List


def build_entry_context(results: Union[Dict, List], indicator_type: str) -> Union[Dict, List]:
    """Formatting results from API to Demisto Context

    Args:
        results: raw results from API response.
        indicator_type: type of indicator.

    Returns:
        Results formatted to Demisto Context
    """
    if isinstance(results, list):
        return [build_entry_context(entry, indicator_type) for entry in results]  # pragma: no cover

    return {
        'ID': results.get('id'),
        'Severity': results.get('severity'),
        indicator_type: results.get('indicator'),
        'Description': results.get('description')
    }