from typing import Union
from typing import Tuple


def get_input(params: Union[dict, list]) -> Tuple[list, dict]:
    """
    Get positional or keyword arguments from JSON RPC params

    :param params: Parameters passed through JSON RPC
    :return: args, kwargs
    """
    # Backwards compatibility for old clients that send params as a list
    if isinstance(params, list):
        args = params
        kwargs = {}
    elif isinstance(params, dict):
        args = params.pop('*args', [])
        kwargs = params
    else:  # pragma no coverage
        raise TypeError(
            'Unknown type {} of params, must be list or dict'.format(type(params)))

    return args, kwargs