def get_protocol(url, default="http"):
	"""
		Extracts the protocol, or returns value of default param (defaults to http)
	"""
	double_slash = url.find("//")

	if double_slash == -1:
		protocol = default
	else:
		protocol = url[:url.find('//')]
		if protocol.endswith(':'):
			protocol = protocol[:-1]

		if protocol == "":
			protocol = default

	return protocol