import re


def escape_single_quote(string):
	"""
	Escape a string containing single quotes and backslashes with backslashes.
	This is useful when a string is evaluated in some way.

	:param str string: The string to escape.
	:return: The escaped string.
	:rtype: str
	"""
	return re.sub('(\'|\\\)', r'\\\1', string)