def check_dist_restriction(options, check_target=False):<EOL>
dist_restriction_set = any([<EOL>options.python_version,<EOL>options.platform,<EOL>options.abi,<EOL>options.implementation,<EOL>])<EOL>binary_only = FormatControl(set(), {'<STR_LIT>'})<EOL>sdist_dependencies_allowed = (<EOL>options.format_control != binary_only and<EOL>not options.ignore_dependencies<EOL>)<EOL>if dist_restriction_set and sdist_dependencies_allowed:<EOL><INDENT>raise CommandError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT>if check_target:<EOL><INDENT>if dist_restriction_set and not options.target_dir:<EOL><INDENT>raise CommandError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>"<EOL>)<EOL><DEDENT><DEDENT>
Function for determining if custom platform options are allowed.

    :param options: The OptionParser options.
    :param check_target: Whether or not to check if --target is being used.