def parse_value(v, parser, config, description):
val = None<EOL>if v == '<STR_LIT>':<EOL><INDENT>return<EOL><DEDENT>if v is not None:<EOL><INDENT>try:<EOL><INDENT>val = load_value_from_schema(v)<EOL><DEDENT>except Exception as e:<EOL><INDENT>six.raise_from(<EOL>CertifierTypeError(<EOL>message='<STR_LIT>'.format(<EOL>description=description,<EOL>kind=type(v).__name__,<EOL>),<EOL>required=config['<STR_LIT>'],<EOL>value=v,<EOL>),<EOL>e)<EOL><DEDENT>else:<EOL><INDENT>if val is None:<EOL><INDENT>try:<EOL><INDENT>return parser(v)<EOL><DEDENT>except CertifierTypeError:<EOL><INDENT>raise<EOL><DEDENT>except CertifierValueError:<EOL><INDENT>raise<EOL><DEDENT>except TypeError as e:<EOL><INDENT>six.raise_from(<EOL>CertifierTypeError(<EOL>message='<STR_LIT>'.format(<EOL>description=description,<EOL>kind=type(v).__name__,<EOL>),<EOL>required=config['<STR_LIT>'],<EOL>value=v,<EOL>),<EOL>e)<EOL><DEDENT>except ValueError as e:<EOL><INDENT>six.raise_from(<EOL>CertifierValueError(<EOL>message='<STR_LIT>'.format(<EOL>description=description,<EOL>value=v,<EOL>),<EOL>required=config['<STR_LIT>'],<EOL>value=v,<EOL>),<EOL>e)<EOL><DEDENT><DEDENT><DEDENT><DEDENT>return val<EOL>
Convert a string received on the command-line into
a value or None.

:param str v:
    The value to parse.
:param parser:
    The fallback callable to load the value if loading
    from scheme fails.
:param dict config:
    The config to use.
:param str description:
    Description (for debugging)
:return:
    The parsed value
:rtype:
    object