(val: str, ref: AnyStr)
Encodes the string *val* using the system filesystem encoding if *ref*
	is of type :any:`bytes`
Encodes the string *val* using the system filesystem encoding if *ref*
	is of type :any:`bytes`
Encodes the string * val * using the system filesystem encoding if * ref * is of type : any : bytes
def maybe_fsencode(val: str, ref: AnyStr) -> AnyStr:
	"""Encodes the string *val* using the system filesystem encoding if *ref*
	is of type :any:`bytes`"""

	if isinstance(ref, bytes):
		return os.fsencode(val)
	else:
		return val
def maybe_fsencode ( val : str , ref : AnyStr ) -> AnyStr : if isinstance ( ref , bytes ) : return os . fsencode ( val ) else : return val