def get_namespace(type_or_context):
    """
    Utility function to extract the namespace from a type (@odata.type) or context (@odata.context)
    :param type_or_context: the type or context value
    :type type_or_context: str
    :return: the namespace
    """
    if '#' in type_or_context:
        type_or_context = type_or_context.rsplit('#', 1)[1]
    return type_or_context.rsplit('.', 1)[0]