<human>:  Can you show me a Python code to truncate spaces in strings.
<bot>:
  else:
    return text

# Enter the string
text = "This is a long string"

# Calling the function
print((truncate(text, 10)))

#Example Output
# This is a 

#Remember to inspect code for bugs.