Load and parse input if needed.

    :param definition: definition to use as an input (file, serialized JSON/YAML or dict)
    :return: loaded input
    :raises json2sql.ParsingInputError: when parsing fails

def load_input(definition):
    """Load and parse input if needed.

    :param definition: definition to use as an input (file, serialized JSON/YAML or dict)
    :return: loaded input
    :raises json2sql.ParsingInputError: when parsing fails
    """
    if isinstance(definition, (str, io.TextIOWrapper)):
        try:
            definition = yaml.safe_load(definition)
        except Exception as exc:
            raise ParsingInputError("Unable to parse input: %s" % str(exc))

    return definition