def parse(inp, format=None, encoding='<STR_LIT:utf-8>', force_types=True):
proper_inp = inp<EOL>if hasattr(inp, '<STR_LIT>'):<EOL><INDENT>proper_inp = inp.read()<EOL><DEDENT>if isinstance(proper_inp, six.text_type):<EOL><INDENT>proper_inp = proper_inp.encode(encoding)<EOL><DEDENT>fname = None<EOL>if hasattr(inp, '<STR_LIT:name>'):<EOL><INDENT>fname = inp.name<EOL><DEDENT>fmt = _get_format(format, fname, proper_inp)<EOL>proper_inp = six.BytesIO(proper_inp)<EOL>try:<EOL><INDENT>res = _do_parse(proper_inp, fmt, encoding, force_types)<EOL><DEDENT>except Exception as e:<EOL><INDENT>raise AnyMarkupError(e, traceback.format_exc())<EOL><DEDENT>if res is None:<EOL><INDENT>res = {}<EOL><DEDENT>return res<EOL>
Parse input from file-like object, unicode string or byte string.

    Args:
        inp: file-like object, unicode string or byte string with the markup
        format: explicitly override the guessed `inp` markup format
        encoding: `inp` encoding, defaults to utf-8
        force_types:
            if `True`, integers, floats, booleans and none/null
                are recognized and returned as proper types instead of strings;
            if `False`, everything is converted to strings
            if `None`, backend return value is used
    Returns:
        parsed input (dict or list) containing unicode values
    Raises:
        AnyMarkupError if a problem occurs while parsing or inp